chore: Fix design for smaller screens

This commit is contained in:
Christian Pauly 2022-01-15 13:18:25 +01:00
parent de7699addb
commit af02f90a1b
3 changed files with 225 additions and 209 deletions

View File

@ -79,9 +79,11 @@ class _InviteStoryPageState extends State<InviteStoryPage> {
onPressed: () => Navigator.of(context).pop<bool>(false), onPressed: () => Navigator.of(context).pop<bool>(false),
), ),
title: Text(L10n.of(context)!.whoCanSeeMyStories), title: Text(L10n.of(context)!.whoCanSeeMyStories),
bottom: PreferredSize( elevation: 0,
preferredSize: const Size.fromHeight(56), ),
child: ListTile( body: Column(
children: [
ListTile(
title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc), title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
@ -89,18 +91,20 @@ class _InviteStoryPageState extends State<InviteStoryPage> {
child: const Icon(Icons.lock), child: const Icon(Icons.lock),
), ),
), ),
), const Divider(height: 1),
), Expanded(
body: FutureBuilder<List<User>>( child: FutureBuilder<List<User>>(
future: loadContacts, future: loadContacts,
builder: (context, snapshot) { builder: (context, snapshot) {
final contacts = snapshot.data; final contacts = snapshot.data;
if (contacts == null) { if (contacts == null) {
final error = snapshot.error; final error = snapshot.error;
if (error != null) { if (error != null) {
return Center(child: Text(error.toLocalizedString(context))); return Center(
child: Text(error.toLocalizedString(context)));
} }
return const Center(child: CircularProgressIndicator.adaptive()); return const Center(
child: CircularProgressIndicator.adaptive());
} }
_undecided = contacts.map((u) => u.id).toSet(); _undecided = contacts.map((u) => u.id).toSet();
return ListView.builder( return ListView.builder(
@ -118,6 +122,9 @@ class _InviteStoryPageState extends State<InviteStoryPage> {
), ),
); );
}), }),
),
],
),
floatingActionButton: FloatingActionButton.extended( floatingActionButton: FloatingActionButton.extended(
onPressed: _inviteAction, onPressed: _inviteAction,
label: Text(L10n.of(context)!.publish), label: Text(L10n.of(context)!.publish),

View File

@ -28,9 +28,14 @@ class ChatEncryptionSettingsView extends StatelessWidget {
VRouter.of(context).toSegments(['rooms', controller.roomId]), VRouter.of(context).toSegments(['rooms', controller.roomId]),
), ),
title: Text(L10n.of(context).tapOnDeviceToVerify), title: Text(L10n.of(context).tapOnDeviceToVerify),
bottom: PreferredSize( elevation: 0,
preferredSize: const Size.fromHeight(56), ),
child: ListTile( body: MaxWidthBody(
withScrolling: true,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Text(L10n.of(context).deviceVerifyDescription), title: Text(L10n.of(context).deviceVerifyDescription),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
@ -38,11 +43,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
child: const Icon(Icons.lock), child: const Icon(Icons.lock),
), ),
), ),
), const Divider(height: 1),
), StreamBuilder(
body: MaxWidthBody(
withScrolling: true,
child: StreamBuilder(
stream: room.onUpdate.stream, stream: room.onUpdate.stream,
builder: (context, snapshot) { builder: (context, snapshot) {
return FutureBuilder<List<DeviceKeys>>( return FutureBuilder<List<DeviceKeys>>(
@ -57,8 +59,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
} }
if (!snapshot.hasData) { if (!snapshot.hasData) {
return const Center( return const Center(
child: child: CircularProgressIndicator.adaptive(
CircularProgressIndicator.adaptive(strokeWidth: 2)); strokeWidth: 2));
} }
final deviceKeys = snapshot.data; final deviceKeys = snapshot.data;
return ListView.builder( return ListView.builder(
@ -119,8 +121,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
if (deviceKeys[i].blocked || if (deviceKeys[i].blocked ||
!deviceKeys[i].verified) { !deviceKeys[i].verified) {
items.add(PopupMenuItem( items.add(PopupMenuItem(
value: value: deviceKeys[i].userId ==
deviceKeys[i].userId == room.client.userID room.client.userID
? 'verify' ? 'verify'
: 'verify_user', : 'verify_user',
child: Text(L10n.of(context).verifyStart), child: Text(L10n.of(context).verifyStart),
@ -180,6 +182,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
}, },
); );
}), }),
],
),
), ),
); );
} }

View File

@ -17,9 +17,11 @@ class SettingsStoriesView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.whoCanSeeMyStories), title: Text(L10n.of(context)!.whoCanSeeMyStories),
bottom: PreferredSize( elevation: 0,
preferredSize: const Size.fromHeight(56), ),
child: ListTile( body: Column(
children: [
ListTile(
title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc), title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc),
leading: CircleAvatar( leading: CircleAvatar(
backgroundColor: Theme.of(context).secondaryHeaderColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
@ -27,9 +29,9 @@ class SettingsStoriesView extends StatelessWidget {
child: const Icon(Icons.lock), child: const Icon(Icons.lock),
), ),
), ),
), const Divider(height: 1),
), Expanded(
body: FutureBuilder( child: FutureBuilder(
future: controller.loadUsers, future: controller.loadUsers,
builder: (context, snapshot) { builder: (context, snapshot) {
final error = snapshot.error; final error = snapshot.error;
@ -59,6 +61,9 @@ class SettingsStoriesView extends StatelessWidget {
); );
}, },
), ),
),
],
),
); );
} }
} }