design: Adaptive switches

This commit is contained in:
Krille Fear 2021-11-27 10:10:29 +01:00
commit 956ee5bfc6
8 changed files with 17 additions and 19 deletions

View file

@ -7,7 +7,7 @@ import 'package:fluffychat/utils/sentry_controller.dart';
class SentrySwitchListTile extends StatefulWidget {
final String label;
const SentrySwitchListTile({Key key, this.label}) : super(key: key);
const SentrySwitchListTile.adaptive({Key key, this.label}) : super(key: key);
@override
_SentrySwitchListTileState createState() => _SentrySwitchListTileState();
@ -22,7 +22,7 @@ class _SentrySwitchListTileState extends State<SentrySwitchListTile> {
future: SentryController.getSentryStatus(),
builder: (context, snapshot) {
_enabled = snapshot.data ?? false;
return SwitchListTile(
return SwitchListTile.adaptive(
title: Text(widget.label ?? L10n.of(context).sendBugReports),
value: _enabled,
onChanged: (b) =>

View file

@ -8,7 +8,7 @@ class SettingsSwitchListTile extends StatefulWidget {
final String title;
final Function(bool) onChanged;
const SettingsSwitchListTile({
const SettingsSwitchListTile.adaptive({
Key key,
this.defaultValue = false,
@required this.storeKey,
@ -27,7 +27,7 @@ class _SettingsSwitchListTileState extends State<SettingsSwitchListTile> {
future: Matrix.of(context)
.store
.getItemBool(widget.storeKey, widget.defaultValue),
builder: (context, snapshot) => SwitchListTile(
builder: (context, snapshot) => SwitchListTile.adaptive(
value: snapshot.data ?? widget.defaultValue,
title: Text(widget.title),
onChanged: (bool newValue) async {