Clean up design
This commit is contained in:
parent
7e8ad4a42c
commit
a6dd9072a2
16 changed files with 141 additions and 201 deletions
|
|
@ -2,9 +2,7 @@ import 'package:bubble/bubble.dart';
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/utils/event_extension.dart';
|
||||
import 'package:fluffychat/views/content_web_view.dart';
|
||||
import 'package:fluffychat/views/image_viewer.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -77,12 +75,8 @@ class MessageContent extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
ContentWebView(MxContent(event.content["url"])),
|
||||
),
|
||||
),
|
||||
onPressed: () => launch(MxContent(event.content["url"])
|
||||
.getDownloadLink(event.room.client)),
|
||||
),
|
||||
);
|
||||
case MessageTypes.Video:
|
||||
|
|
@ -102,11 +96,9 @@ class MessageContent extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
ContentWebView(MxContent(event.content["url"])),
|
||||
),
|
||||
onPressed: () => launch(
|
||||
MxContent(event.content["url"])
|
||||
.getDownloadLink(event.room.client),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
86
lib/components/settings_themes.dart
Normal file
86
lib/components/settings_themes.dart
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../components/theme_switcher.dart';
|
||||
import '../components/matrix.dart';
|
||||
import '../i18n/i18n.dart';
|
||||
|
||||
class ThemesSettings extends StatefulWidget {
|
||||
@override
|
||||
ThemesSettingsState createState() => ThemesSettingsState();
|
||||
}
|
||||
|
||||
class ThemesSettingsState extends State<ThemesSettings> {
|
||||
Themes _selectedTheme;
|
||||
bool _amoledEnabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final MatrixState matrix = Matrix.of(context);
|
||||
final ThemeSwitcherWidgetState themeEngine =
|
||||
ThemeSwitcherWidget.of(context);
|
||||
_selectedTheme = themeEngine.selectedTheme;
|
||||
_amoledEnabled = themeEngine.amoledEnabled;
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
RadioListTile<Themes>(
|
||||
title: Text(
|
||||
I18n.of(context).systemTheme,
|
||||
),
|
||||
value: Themes.system,
|
||||
groupValue: _selectedTheme,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (Themes value) {
|
||||
setState(() {
|
||||
_selectedTheme = value;
|
||||
themeEngine.switchTheme(matrix, value, _amoledEnabled);
|
||||
});
|
||||
},
|
||||
),
|
||||
RadioListTile<Themes>(
|
||||
title: Text(
|
||||
I18n.of(context).lightTheme,
|
||||
),
|
||||
value: Themes.light,
|
||||
groupValue: _selectedTheme,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (Themes value) {
|
||||
setState(() {
|
||||
_selectedTheme = value;
|
||||
themeEngine.switchTheme(matrix, value, _amoledEnabled);
|
||||
});
|
||||
},
|
||||
),
|
||||
RadioListTile<Themes>(
|
||||
title: Text(
|
||||
I18n.of(context).darkTheme,
|
||||
),
|
||||
value: Themes.dark,
|
||||
groupValue: _selectedTheme,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (Themes value) {
|
||||
setState(() {
|
||||
_selectedTheme = value;
|
||||
themeEngine.switchTheme(matrix, value, _amoledEnabled);
|
||||
});
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
I18n.of(context).useAmoledTheme,
|
||||
),
|
||||
trailing: Switch(
|
||||
value: _amoledEnabled,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_amoledEnabled = value;
|
||||
themeEngine.switchTheme(matrix, _selectedTheme, value);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue