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

View File

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

View File

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

View File

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

View File

@ -58,26 +58,33 @@ class SettingsNotifications extends StatefulWidget {
class SettingsNotificationsController extends State<SettingsNotifications> {
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) {
case PushRuleKind.content:
return pushRules!.content
return pushRules.content
?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled;
case PushRuleKind.override:
return pushRules!.override
return pushRules.override
?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled;
case PushRuleKind.room:
return pushRules!.room
return pushRules.room
?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled;
case PushRuleKind.sender:
return pushRules!.sender
return pushRules.sender
?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled;
case PushRuleKind.underride:
return pushRules!.underride
return pushRules.underride
?.singleWhereOrNull((r) => r.ruleId == item.key)
?.enabled;
}

View File

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

View File

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