mirror of
https://github.com/git-touch/git-touch
synced 2025-03-08 07:25:09 +01:00
refactor: settings
This commit is contained in:
parent
90d471a8ca
commit
8028a4fbce
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/scaffolds/single.dart';
|
import 'package:git_touch/scaffolds/single.dart';
|
||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
|
import 'package:git_touch/widgets/action_button.dart';
|
||||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||||
import 'package:git_touch/widgets/table_view.dart';
|
import 'package:git_touch/widgets/table_view.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -38,49 +39,54 @@ class SettingsScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
TableView(
|
TableView(headerText: 'THEME', items: [
|
||||||
headerText: 'APP THEME',
|
TableViewItem(
|
||||||
items: [
|
text: Text('Scaffold'),
|
||||||
Tuple2('Material', AppThemeType.material),
|
rightWidget: Text(theme.theme == AppThemeType.cupertino
|
||||||
Tuple2('Cupertino', AppThemeType.cupertino),
|
? 'Cupertino'
|
||||||
].map((t) {
|
: 'Material'),
|
||||||
return TableViewItem(
|
onTap: () {
|
||||||
text: Text(t.item1),
|
theme.showActions(context, [
|
||||||
rightWidget: _buildRightWidget(
|
for (var t in [
|
||||||
context,
|
Tuple2('Material', AppThemeType.material),
|
||||||
theme.theme == t.item2,
|
Tuple2('Cupertino', AppThemeType.cupertino),
|
||||||
),
|
])
|
||||||
onTap: () {
|
ActionItem(
|
||||||
if (theme.theme != t.item2) {
|
text: t.item1,
|
||||||
theme.setTheme(t.item2);
|
onTap: (_) {
|
||||||
}
|
if (theme.theme != t.item2) {
|
||||||
},
|
theme.setTheme(t.item2);
|
||||||
hideRightChevron: true,
|
}
|
||||||
);
|
},
|
||||||
}).toList(),
|
)
|
||||||
),
|
]);
|
||||||
CommonStyle.verticalGap,
|
},
|
||||||
TableView(
|
),
|
||||||
headerText: 'BRIGHTNESS',
|
TableViewItem(
|
||||||
items: [
|
text: Text('Brightness'),
|
||||||
Tuple2('Follow System', AppBrightnessType.followSystem),
|
rightWidget: Text(theme.brighnessValue == AppBrightnessType.light
|
||||||
Tuple2('Light', AppBrightnessType.light),
|
? 'Light'
|
||||||
Tuple2('Dark', AppBrightnessType.dark),
|
: theme.brighnessValue == AppBrightnessType.dark
|
||||||
].map((t) {
|
? 'Dark'
|
||||||
return TableViewItem(
|
: 'Follow system'),
|
||||||
text: Text(t.item1),
|
onTap: () {
|
||||||
rightWidget: _buildRightWidget(
|
theme.showActions(context, [
|
||||||
context,
|
for (var t in [
|
||||||
theme.brighnessValue == t.item2,
|
Tuple2('Follow System', AppBrightnessType.followSystem),
|
||||||
),
|
Tuple2('Light', AppBrightnessType.light),
|
||||||
onTap: () {
|
Tuple2('Dark', AppBrightnessType.dark),
|
||||||
if (theme.brighnessValue != t.item2)
|
])
|
||||||
theme.setBrightness(t.item2);
|
ActionItem(
|
||||||
},
|
text: t.item1,
|
||||||
hideRightChevron: true,
|
onTap: (_) {
|
||||||
);
|
if (theme.brighnessValue != t.item2)
|
||||||
}).toList(),
|
theme.setBrightness(t.item2);
|
||||||
),
|
},
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
TableView(
|
TableView(
|
||||||
headerText: 'CODE VIEW',
|
headerText: 'CODE VIEW',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user