fix: Styling and notification settings

This commit is contained in:
Christian Pauly 2022-09-06 20:21:11 +02:00
parent db0d49269b
commit 28976ecdef
7 changed files with 29 additions and 6 deletions

View File

@ -17,6 +17,7 @@ class AddStoryView extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: Colors.blueGrey.shade900, backgroundColor: Colors.blueGrey.shade900,
appBar: AppBar( appBar: AppBar(
leading: const BackButton(color: Colors.white),
systemOverlayStyle: SystemUiOverlayStyle.light, systemOverlayStyle: SystemUiOverlayStyle.light,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
@ -38,15 +39,18 @@ class AddStoryView extends StatelessWidget {
if (controller.hasMedia) if (controller.hasMedia)
IconButton( IconButton(
icon: const Icon(Icons.fullscreen_outlined), icon: const Icon(Icons.fullscreen_outlined),
color: Colors.white,
onPressed: controller.toggleBoxFit, onPressed: controller.toggleBoxFit,
), ),
if (!controller.hasMedia) if (!controller.hasMedia)
IconButton( IconButton(
icon: const Icon(Icons.color_lens_outlined), icon: const Icon(Icons.color_lens_outlined),
color: Colors.white,
onPressed: controller.updateColor, onPressed: controller.updateColor,
), ),
IconButton( IconButton(
icon: const Icon(Icons.delete_outlined), icon: const Icon(Icons.delete_outlined),
color: Colors.white,
onPressed: controller.reset, onPressed: controller.reset,
), ),
], ],

View File

@ -19,6 +19,8 @@ class ConnectPageView extends StatelessWidget {
final identityProviders = controller.identityProviders; final identityProviders = controller.identityProviders;
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading:
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
centerTitle: true, centerTitle: true,
title: Text( title: Text(

View File

@ -22,16 +22,19 @@ class HomeserverPickerView extends StatelessWidget {
IconButton( IconButton(
onPressed: controller.restoreBackup, onPressed: controller.restoreBackup,
tooltip: L10n.of(context)!.hydrate, tooltip: L10n.of(context)!.hydrate,
color: Colors.white,
icon: const Icon(Icons.restore_outlined), icon: const Icon(Icons.restore_outlined),
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.privacy, tooltip: L10n.of(context)!.privacy,
onPressed: () => launch(AppConfig.privacyUrl), onPressed: () => launch(AppConfig.privacyUrl),
color: Colors.white,
icon: const Icon(Icons.shield_outlined), icon: const Icon(Icons.shield_outlined),
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.about, tooltip: L10n.of(context)!.about,
onPressed: () => PlatformInfos.showDialog(context), onPressed: () => PlatformInfos.showDialog(context),
color: Colors.white,
icon: const Icon(Icons.info_outlined), icon: const Icon(Icons.info_outlined),
), ),
], ],

View File

@ -15,6 +15,8 @@ class LoginView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading:
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
centerTitle: true, centerTitle: true,
title: Text( title: Text(

View File

@ -58,26 +58,33 @@ class SettingsNotifications extends StatefulWidget {
class SettingsNotificationsController extends State<SettingsNotifications> { class SettingsNotificationsController extends State<SettingsNotifications> {
bool? getNotificationSetting(NotificationSettingsItem item) { bool? getNotificationSetting(NotificationSettingsItem item) {
final pushRules = Matrix.of(context).client.globalPushRules; // Until https://gitlab.com/famedly/company/frontend/famedlysdk/-/merge_requests/1124 is shipped
final pushRulesRaw = Matrix.of(context)
.client
.accountData['m.push_rules']
?.content
.tryGetMap<String, dynamic>('device');
if (pushRulesRaw == null) return null;
final pushRules = PushRuleSet.fromJson(pushRulesRaw);
switch (item.type) { switch (item.type) {
case PushRuleKind.content: case PushRuleKind.content:
return pushRules!.content return pushRules.content
?.singleWhereOrNull((r) => r.ruleId == item.key) ?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled; ?.enabled;
case PushRuleKind.override: case PushRuleKind.override:
return pushRules!.override return pushRules.override
?.singleWhereOrNull((r) => r.ruleId == item.key) ?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled; ?.enabled;
case PushRuleKind.room: case PushRuleKind.room:
return pushRules!.room return pushRules.room
?.singleWhereOrNull((r) => r.ruleId == item.key) ?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled; ?.enabled;
case PushRuleKind.sender: case PushRuleKind.sender:
return pushRules!.sender return pushRules.sender
?.singleWhereOrNull((r) => r.ruleId == item.key) ?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled; ?.enabled;
case PushRuleKind.underride: case PushRuleKind.underride:
return pushRules!.underride return pushRules.underride
?.singleWhereOrNull((r) => r.ruleId == item.key) ?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled; ?.enabled;
} }

View File

@ -13,6 +13,8 @@ class SignupPageView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading:
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
title: Text( title: Text(
L10n.of(context)!.signUp, L10n.of(context)!.signUp,

View File

@ -50,6 +50,7 @@ class StoryView extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
titleSpacing: 0, titleSpacing: 0,
leading: IconButton( leading: IconButton(
color: Colors.white,
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
), ),
@ -96,10 +97,12 @@ class StoryView extends StatelessWidget {
: [ : [
if (!controller.isOwnStory) if (!controller.isOwnStory)
IconButton( IconButton(
color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
onPressed: controller.share, onPressed: controller.share,
), ),
PopupMenuButton<PopupStoryAction>( PopupMenuButton<PopupStoryAction>(
color: Colors.white,
onSelected: controller.onPopupStoryAction, onSelected: controller.onPopupStoryAction,
itemBuilder: (context) => [ itemBuilder: (context) => [
if (controller.currentEvent?.canRedact ?? false) if (controller.currentEvent?.canRedact ?? false)