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">
<plist version="1.0">
<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>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>

View File

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

View File

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

View File

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

View File

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

View File

@ -10,41 +10,38 @@ class MyDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _drawerProviders = Provider.of<DrawerProvider>(context);
return SizedBox(
width: MediaQuery.of(context).size.width * 0.82,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Builder(builder: (context) {
return Column(
children: [
const SizedBox(height: 30.0),
SvgPicture.asset(
'assets/logo.svg',
height: 55.0,
return Padding(
padding: const EdgeInsets.all(10.0),
child: Builder(builder: (context) {
return Column(
children: [
const SizedBox(height: 30.0),
SvgPicture.asset(
'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),
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),
),
],
);
}),
),
onTap: () => _switchProfile(context),
),
],
);
}),
);
}

View File

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

View File

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

View File

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