fixed the responsive issues + other

This commit is contained in:
Muhammad Hamza 2021-10-18 22:11:31 +05:00
parent c183c819fc
commit 7248e6096d
9 changed files with 102 additions and 90 deletions

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>

View File

@ -180,17 +180,23 @@ class _ConversationsState extends State<Conversations> {
offset: const Offset(-10, -155), offset: const Offset(-10, -155),
onSelected: (value) async { onSelected: (value) async {
if (value == _options[0]) { if (value == _options[0]) {
await Navigator.pushNamed(context, AppRoutes.scanInvitation); var newMember =
await Navigator.pushNamed(context, AppRoutes.scanInvitation);
newMember ??= false;
if (newMember == true) {
_addNewMember();
}
} else if (value == _options[1]) { } else if (value == _options[1]) {
var value = var newMember =
await Navigator.pushNamed(context, AppRoutes.addContact); await Navigator.pushNamed(context, AppRoutes.addContact);
value ??= false; newMember ??= false;
if (value == true) { if (newMember == true) {
_addNewMember(); _addNewMember();
} }
} else { } else {
var value = await Navigator.pushNamed(context, AppRoutes.addGroup); var newGroup =
if (value == true) { await Navigator.pushNamed(context, AppRoutes.addGroup);
if (newGroup == true) {
_getGroups(); _getGroups();
} }
} }

View File

@ -121,7 +121,7 @@ class _ConversationViewState extends State<ConversationView> {
}); });
}, },
icon: const Icon( icon: const Icon(
Icons.message, Icons.bug_report,
), ),
) )
], ],

View File

@ -182,6 +182,7 @@ class _GroupDetailsConversationState extends State<GroupDetailsConversation> {
} }
void _memberSettings(String contact) { void _memberSettings(String contact) {
Size _size = MediaQuery.of(context).size;
showDialog( showDialog(
context: context, context: context,
builder: (context) => StatefulBuilder( builder: (context) => StatefulBuilder(
@ -192,7 +193,7 @@ class _GroupDetailsConversationState extends State<GroupDetailsConversation> {
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Spacer(), SizedBox(width: _size.width * 0.15),
const Expanded(child: Text('Owner')), const Expanded(child: Text('Owner')),
Radio( Radio(
value: MemberSetting.owner, value: MemberSetting.owner,
@ -202,13 +203,13 @@ class _GroupDetailsConversationState extends State<GroupDetailsConversation> {
_memberSetting = value!; _memberSetting = value!;
}); });
}), }),
const Spacer(), SizedBox(width: _size.width * 0.15),
], ],
), ),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Spacer(), SizedBox(width: _size.width * 0.15),
const Expanded(child: Text('Admin')), const Expanded(child: Text('Admin')),
Radio( Radio(
groupValue: _memberSetting, groupValue: _memberSetting,
@ -218,13 +219,13 @@ class _GroupDetailsConversationState extends State<GroupDetailsConversation> {
_memberSetting = value!; _memberSetting = value!;
}); });
}), }),
const Spacer(), SizedBox(width: _size.width * 0.15),
], ],
), ),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Spacer(), SizedBox(width: _size.width * 0.15),
const Expanded(child: Text('Member')), const Expanded(child: Text('Member')),
Radio( Radio(
groupValue: _memberSetting, groupValue: _memberSetting,
@ -234,7 +235,7 @@ class _GroupDetailsConversationState extends State<GroupDetailsConversation> {
_memberSetting = value!; _memberSetting = value!;
}); });
}), }),
const Spacer(), SizedBox(width: _size.width * 0.15),
], ],
), ),
const Divider(), const Divider(),

View File

@ -77,6 +77,7 @@ class _AddGroupViewState extends State<AddGroupView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Size _size = MediaQuery.of(context).size;
return GestureDetector( return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold( child: Scaffold(
@ -94,7 +95,7 @@ class _AddGroupViewState extends State<AddGroupView> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
Center( Center(
child: SizedBox( child: SizedBox(
height: 180.0, height: 180.0,
@ -103,13 +104,14 @@ class _AddGroupViewState extends State<AddGroupView> {
children: [ children: [
_imageUploaded _imageUploaded
? CircleAvatar( ? CircleAvatar(
radius: 100.0, radius: _size.height * 0.12,
backgroundImage: backgroundImage:
FileImage(File(_groupPhotoPath)), FileImage(File(_groupPhotoPath)),
) )
: const CircleAvatar( : CircleAvatar(
radius: 100.0, radius: _size.height * 0.12,
backgroundImage: AssetImage('assets/dp.png'), backgroundImage:
const AssetImage('assets/dp.png'),
), ),
Positioned( Positioned(
right: 0, right: 0,
@ -140,9 +142,9 @@ class _AddGroupViewState extends State<AddGroupView> {
), ),
), ),
), ),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.03),
const Text('Group Name', style: kSmallHeadingStyle), const Text('Group Name', style: kSmallHeadingStyle),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
CustomTextField( CustomTextField(
textEditingController: _displayNameController, textEditingController: _displayNameController,
textInputType: TextInputType.name, textInputType: TextInputType.name,
@ -154,15 +156,15 @@ class _AddGroupViewState extends State<AddGroupView> {
return null; return null;
}, },
), ),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
const Text('Group Description', style: kSmallHeadingStyle), const Text('Group Description', style: kSmallHeadingStyle),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
CustomTextField( CustomTextField(
textEditingController: _descController, textEditingController: _descController,
textInputType: TextInputType.text, textInputType: TextInputType.text,
hintText: 'e.g Friends from UK', hintText: 'e.g Friends from UK',
), ),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
_members.isNotEmpty _members.isNotEmpty
? const Text('Members Added') ? const Text('Members Added')
: Container(), : Container(),
@ -194,7 +196,8 @@ class _AddGroupViewState extends State<AddGroupView> {
)), )),
) )
: Container(), : Container(),
SizedBox(height: _members.isNotEmpty ? 10.0 : 0.0), SizedBox(
height: _members.isNotEmpty ? _size.height * 0.012 : 0.0),
ListTile( ListTile(
leading: const Icon(Icons.person_add), leading: const Icon(Icons.person_add),
title: const Text('Add a member'), title: const Text('Add a member'),
@ -204,9 +207,9 @@ class _AddGroupViewState extends State<AddGroupView> {
}); });
}, },
), ),
SizedBox(height: _addMember ? 10.0 : 0.0), SizedBox(height: _addMember ? _size.height * 0.012 : 0.0),
_addMember ? const Text('Contacts Available') : Container(), _addMember ? const Text('Contacts Available') : Container(),
SizedBox(height: _addMember ? 10.0 : 0.0), SizedBox(height: _addMember ? _size.height * 0.012 : 0.0),
_addMember _addMember
? ListView( ? ListView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -227,7 +230,7 @@ class _AddGroupViewState extends State<AddGroupView> {
), ),
) )
: Container(), : Container(),
const Divider(height: 30.0), Divider(height: _size.height * 0.035),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundImage: _userPhotoPath == '' backgroundImage: _userPhotoPath == ''

View File

@ -10,41 +10,38 @@ class MyDrawer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _drawerProviders = Provider.of<DrawerProvider>(context); final _drawerProviders = Provider.of<DrawerProvider>(context);
return SizedBox( return Padding(
width: MediaQuery.of(context).size.width * 0.82, padding: const EdgeInsets.all(10.0),
child: Padding( child: Builder(builder: (context) {
padding: const EdgeInsets.all(10.0), return Column(
child: Builder(builder: (context) { children: [
return Column( const SizedBox(height: 30.0),
children: [ SvgPicture.asset(
const SizedBox(height: 30.0), 'assets/logo.svg',
SvgPicture.asset( height: 55.0,
'assets/logo.svg', ),
height: 55.0, const Divider(height: 30.0),
ListTile(
leading: const Icon(Icons.insert_invitation),
title: const Text('Invitations'),
onTap: () {
_drawerProviders.currentIndex = 2;
Navigator.pop(context);
},
),
const Spacer(),
ListTile(
leading: const Icon(Icons.refresh),
title: const Text('Switch Profile'),
subtitle: const Text(
'Not supported yet!',
style: TextStyle(fontStyle: FontStyle.italic),
), ),
const Divider(height: 30.0), onTap: () => _switchProfile(context),
ListTile( ),
leading: const Icon(Icons.insert_invitation), ],
title: const Text('Invitations'), );
onTap: () { }),
_drawerProviders.currentIndex = 2;
Navigator.pop(context);
},
),
const Spacer(),
ListTile(
leading: const Icon(Icons.refresh),
title: const Text('Switch Profile'),
subtitle: const Text(
'Not supported yet!',
style: TextStyle(fontStyle: FontStyle.italic),
),
onTap: () => _switchProfile(context),
),
],
);
}),
),
); );
} }

View File

@ -53,9 +53,7 @@ class _HomeViewState extends State<HomeView> {
return WillPopScope( return WillPopScope(
onWillPop: _onWillPop, onWillPop: _onWillPop,
child: Scaffold( child: Scaffold(
drawer: const Drawer( drawer: const Drawer(child: MyDrawer()),
child: MyDrawer(),
),
body: SafeArea( body: SafeArea(
child: Builder(builder: (context) { child: Builder(builder: (context) {
return Stack( return Stack(

View File

@ -63,6 +63,7 @@ class _ProfileViewState extends State<ProfileView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Size _size = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
body: GestureDetector( body: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
@ -75,7 +76,7 @@ class _ProfileViewState extends State<ProfileView> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const SizedBox(height: 30), SizedBox(height: _size.height * 0.05),
Center( Center(
child: SizedBox( child: SizedBox(
height: 180.0, height: 180.0,
@ -119,7 +120,7 @@ class _ProfileViewState extends State<ProfileView> {
], ],
), ),
)), )),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.035),
const Text('Display Name', style: kSmallHeadingStyle), const Text('Display Name', style: kSmallHeadingStyle),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
CustomTextField( CustomTextField(
@ -133,15 +134,15 @@ class _ProfileViewState extends State<ProfileView> {
return null; return null;
}, },
), ),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.035),
const Text('Full Name', style: kSmallHeadingStyle), const Text('Full Name', style: kSmallHeadingStyle),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.012),
CustomTextField( CustomTextField(
textEditingController: _fullNameController, textEditingController: _fullNameController,
textInputType: TextInputType.name, textInputType: TextInputType.name,
hintText: 'e.g John Doe', hintText: 'e.g John Doe',
), ),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.035),
const Text( const Text(
'Your display name is what your contact will know you :)', 'Your display name is what your contact will know you :)',
style: TextStyle(letterSpacing: 1.2), style: TextStyle(letterSpacing: 1.2),
@ -186,6 +187,7 @@ class _ProfileViewState extends State<ProfileView> {
} }
void _updateProfilePic() { void _updateProfilePic() {
Size _size = MediaQuery.of(context).size;
showModalBottomSheet( showModalBottomSheet(
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -206,7 +208,7 @@ class _ProfileViewState extends State<ProfileView> {
height: 7.0, height: 7.0,
width: 50.0, width: 50.0,
), ),
const SizedBox(height: 20.0), SizedBox(height: _size.height * 0.025),
const Align( const Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
@ -214,7 +216,7 @@ class _ProfileViewState extends State<ProfileView> {
style: kHeadingStyle, style: kHeadingStyle,
), ),
), ),
const SizedBox(height: 15.0), SizedBox(height: _size.height * 0.015),
Row( Row(
children: List.generate( children: List.generate(
3, 3,

View File

@ -8,6 +8,7 @@ class ScanInvitationView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Size _size = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBar( appBar: AppBar(
@ -24,23 +25,23 @@ class ScanInvitationView extends StatelessWidget {
style: kMediumHeadingStyle, style: kMediumHeadingStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.04),
GestureDetector( GestureDetector(
onTap: () => _showConnection(context), onTap: () => _showConnection(context),
child: Image.asset( child: Image.asset(
'assets/code.png', 'assets/code.png',
), ),
), ),
const SizedBox(height: 25.0), SizedBox(height: _size.height * 0.04),
const Text( const Text(
'If you cannot share your QR Code, send the invitation via a trusted method.', 'If you cannot share your QR Code, send the invitation via a trusted method.',
style: kMediumHeadingStyle, style: kMediumHeadingStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(height: 30.0), SizedBox(height: _size.height * 0.04),
CustomButton( CustomButton(
width: 200.0, width: _size.width * 0.5,
height: 45.0, height: _size.height * 0.055,
onPressed: _shareLink, onPressed: _shareLink,
color: kPrimaryColor, color: kPrimaryColor,
child: Row( child: Row(
@ -63,29 +64,31 @@ class ScanInvitationView extends StatelessWidget {
} }
void _showConnection(BuildContext context) { void _showConnection(BuildContext context) {
Size _size = MediaQuery.of(context).size;
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const CircleAvatar( CircleAvatar(
backgroundImage: AssetImage('assets/dp.png'), backgroundImage: const AssetImage('assets/dp.png'),
radius: 70, radius: _size.height * 0.085,
), ),
const SizedBox(height: 30.0), SizedBox(height: _size.height * 0.045),
const Text( const Text(
'Bob wants to connect with you!', 'Bob wants to connect with you!',
style: kMediumHeadingStyle, style: kMediumHeadingStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(height: 30.0), SizedBox(height: _size.height * 0.045),
CustomButton( CustomButton(
width: 200, width: _size.width * 0.5,
height: 40, height: _size.height * 0.055,
onPressed: () { onPressed: () {
int _count = 0; // work around for now
Navigator.popUntil(context, (route) => _count++ >= 2); Navigator.pop(context);
Navigator.of(context).pop(true);
}, },
color: kPrimaryColor, color: kPrimaryColor,
child: const Text( child: const Text(
@ -93,10 +96,10 @@ class ScanInvitationView extends StatelessWidget {
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
), ),
const SizedBox(height: 10.0), SizedBox(height: _size.height * 0.013),
CustomButton( CustomButton(
width: 200, width: _size.width * 0.5,
height: 40, height: _size.height * 0.055,
onPressed: () { onPressed: () {
int _count = 0; int _count = 0;
Navigator.popUntil(context, (route) => _count++ >= 2); Navigator.popUntil(context, (route) => _count++ >= 2);
@ -107,8 +110,6 @@ class ScanInvitationView extends StatelessWidget {
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
), ),
const SizedBox(height: 20.0),
const Text('Invitation was sent HH:MM')
], ],
), ),
), ),