Skip to content

Commit d6a24c2

Browse files
authored
fix: settings screen repetition (#252)
1 parent 68253e0 commit d6a24c2

File tree

1 file changed

+139
-143
lines changed

1 file changed

+139
-143
lines changed

lib/screens/settings.dart

Lines changed: 139 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,6 @@ class SettingsScreen extends StatelessWidget {
7373
url: '/login',
7474
rightWidget: Text(auth.activeAccount!.login),
7575
),
76-
TableViewItem(
77-
leftIconData: Octicons.info,
78-
text: Text(AppLocalizations.of(context)!.giteaStatus),
79-
url: '/gitea/status',
80-
rightWidget: FutureBuilder<String>(
81-
future:
82-
auth.fetchGitea('/version').then((v) => v['version']),
83-
builder: (context, snapshot) {
84-
return Text(snapshot.data ?? '');
85-
},
86-
),
87-
),
88-
TableViewItem(
89-
text: Text(AppLocalizations.of(context)!.switchAccounts),
90-
url: '/login',
91-
rightWidget: Text(auth.activeAccount!.login),
92-
),
9376
TableViewItem(
9477
text: Text(AppLocalizations.of(context)!.appLanguage),
9578
rightWidget: Text(theme.locale == null
@@ -124,134 +107,147 @@ class SettingsScreen extends StatelessWidget {
124107
)
125108
]),
126109
CommonStyle.verticalGap,
127-
TableView(headerText: AppLocalizations.of(context)!.theme, items: [
128-
TableViewItem(
129-
text: Text(AppLocalizations.of(context)!.brightness),
130-
rightWidget: Text(theme.brighnessValue == AppBrightnessType.light
131-
? AppLocalizations.of(context)!.light
132-
: theme.brighnessValue == AppBrightnessType.dark
133-
? AppLocalizations.of(context)!.dark
134-
: AppLocalizations.of(context)!.followSystem),
135-
onTap: () {
136-
theme.showActions(context, [
137-
for (var t in [
138-
Tuple2(AppLocalizations.of(context)!.followSystem,
139-
AppBrightnessType.followSystem),
140-
Tuple2(AppLocalizations.of(context)!.light,
141-
AppBrightnessType.light),
142-
Tuple2(AppLocalizations.of(context)!.dark,
143-
AppBrightnessType.dark),
144-
])
145-
ActionItem(
146-
text: t.item1,
147-
onTap: (_) {
148-
if (theme.brighnessValue != t.item2)
149-
theme.setBrightness(t.item2);
150-
},
151-
)
152-
]);
153-
},
154-
),
155-
TableViewItem(
156-
text: Text(AppLocalizations.of(context)!.scaffoldTheme),
157-
rightWidget: Text(theme.theme == AppThemeType.cupertino
158-
? AppLocalizations.of(context)!.cupertino
159-
: AppLocalizations.of(context)!.material),
160-
onTap: () {
161-
theme.showActions(context, [
162-
for (var t in [
163-
Tuple2(AppLocalizations.of(context)!.material,
164-
AppThemeType.material),
165-
Tuple2(AppLocalizations.of(context)!.cupertino,
166-
AppThemeType.cupertino),
167-
])
168-
ActionItem(
169-
text: t.item1,
170-
onTap: (_) {
171-
if (theme.theme != t.item2) {
172-
theme.setTheme(t.item2);
173-
}
174-
},
175-
)
176-
]);
177-
},
178-
),
179-
TableViewItem(
180-
text: Text(AppLocalizations.of(context)!.codeTheme),
181-
url: '/choose-code-theme',
182-
rightWidget: Text('${code.fontFamily}, ${code.fontSize}pt'),
183-
),
184-
TableViewItem(
185-
text: Text(AppLocalizations.of(context)!.markdownRenderEngine),
186-
rightWidget: Text(theme.markdown == AppMarkdownType.flutter
187-
? AppLocalizations.of(context)!.flutter
188-
: AppLocalizations.of(context)!.webview),
189-
onTap: () {
190-
theme.showActions(context, [
191-
for (var t in [
192-
Tuple2(AppLocalizations.of(context)!.flutter,
193-
AppMarkdownType.flutter),
194-
Tuple2(AppLocalizations.of(context)!.webview,
195-
AppMarkdownType.webview),
196-
])
197-
ActionItem(
198-
text: t.item1,
199-
onTap: (_) {
200-
if (theme.markdown != t.item2) {
201-
theme.setMarkdown(t.item2);
202-
}
203-
},
204-
)
205-
]);
206-
},
207-
),
208-
]),
110+
TableView(
111+
hasIcon: false,
112+
headerText: AppLocalizations.of(context)!.theme,
113+
items: [
114+
TableViewItem(
115+
text: Text(AppLocalizations.of(context)!.brightness),
116+
rightWidget:
117+
Text(theme.brighnessValue == AppBrightnessType.light
118+
? AppLocalizations.of(context)!.light
119+
: theme.brighnessValue == AppBrightnessType.dark
120+
? AppLocalizations.of(context)!.dark
121+
: AppLocalizations.of(context)!.followSystem),
122+
onTap: () {
123+
theme.showActions(context, [
124+
for (var t in [
125+
Tuple2(AppLocalizations.of(context)!.followSystem,
126+
AppBrightnessType.followSystem),
127+
Tuple2(AppLocalizations.of(context)!.light,
128+
AppBrightnessType.light),
129+
Tuple2(AppLocalizations.of(context)!.dark,
130+
AppBrightnessType.dark),
131+
])
132+
ActionItem(
133+
text: t.item1,
134+
onTap: (_) {
135+
if (theme.brighnessValue != t.item2)
136+
theme.setBrightness(t.item2);
137+
},
138+
)
139+
]);
140+
},
141+
),
142+
TableViewItem(
143+
text: Text(AppLocalizations.of(context)!.scaffoldTheme),
144+
rightWidget: Text(theme.theme == AppThemeType.cupertino
145+
? AppLocalizations.of(context)!.cupertino
146+
: AppLocalizations.of(context)!.material),
147+
onTap: () {
148+
theme.showActions(context, [
149+
for (var t in [
150+
Tuple2(AppLocalizations.of(context)!.material,
151+
AppThemeType.material),
152+
Tuple2(AppLocalizations.of(context)!.cupertino,
153+
AppThemeType.cupertino),
154+
])
155+
ActionItem(
156+
text: t.item1,
157+
onTap: (_) {
158+
if (theme.theme != t.item2) {
159+
theme.setTheme(t.item2);
160+
}
161+
},
162+
)
163+
]);
164+
},
165+
),
166+
TableViewItem(
167+
text: Text(AppLocalizations.of(context)!.codeTheme),
168+
url: '/choose-code-theme',
169+
rightWidget: Text('${code.fontFamily}, ${code.fontSize}pt'),
170+
),
171+
TableViewItem(
172+
text: Text(AppLocalizations.of(context)!.markdownRenderEngine),
173+
rightWidget: Text(theme.markdown == AppMarkdownType.flutter
174+
? AppLocalizations.of(context)!.flutter
175+
: AppLocalizations.of(context)!.webview),
176+
onTap: () {
177+
theme.showActions(context, [
178+
for (var t in [
179+
Tuple2(AppLocalizations.of(context)!.flutter,
180+
AppMarkdownType.flutter),
181+
Tuple2(AppLocalizations.of(context)!.webview,
182+
AppMarkdownType.webview),
183+
])
184+
ActionItem(
185+
text: t.item1,
186+
onTap: (_) {
187+
if (theme.markdown != t.item2) {
188+
theme.setMarkdown(t.item2);
189+
}
190+
},
191+
)
192+
]);
193+
},
194+
),
195+
],
196+
),
209197
CommonStyle.verticalGap,
210-
TableView(headerText: AppLocalizations.of(context)!.feedback, items: [
211-
TableViewItem(
212-
text: Text(AppLocalizations.of(context)!.submitAnIssue),
213-
rightWidget: Text('git-touch/git-touch'),
214-
url: (auth.activeAccount!.platform == PlatformType.github
215-
? '/github'
216-
: 'https://github.com') +
217-
'/git-touch/git-touch/issues/new',
218-
),
219-
TableViewItem(
220-
text: Text(AppLocalizations.of(context)!.rateThisApp),
221-
onTap: () {
222-
LaunchReview.launch(
223-
androidAppId: 'io.github.pd4d10.gittouch',
224-
iOSAppId: '1452042346',
225-
);
226-
},
227-
),
228-
TableViewItem(
229-
text: Text(AppLocalizations.of(context)!.email),
230-
rightWidget: Text('[email protected]'),
231-
hideRightChevron: true,
232-
url: 'mailto:[email protected]',
233-
),
234-
]),
198+
TableView(
199+
hasIcon: false,
200+
headerText: AppLocalizations.of(context)!.feedback,
201+
items: [
202+
TableViewItem(
203+
text: Text(AppLocalizations.of(context)!.submitAnIssue),
204+
rightWidget: Text('git-touch/git-touch'),
205+
url: (auth.activeAccount!.platform == PlatformType.github
206+
? '/github'
207+
: 'https://github.com') +
208+
'/git-touch/git-touch/issues/new',
209+
),
210+
TableViewItem(
211+
text: Text(AppLocalizations.of(context)!.rateThisApp),
212+
onTap: () {
213+
LaunchReview.launch(
214+
androidAppId: 'io.github.pd4d10.gittouch',
215+
iOSAppId: '1452042346',
216+
);
217+
},
218+
),
219+
TableViewItem(
220+
text: Text(AppLocalizations.of(context)!.email),
221+
rightWidget: Text('[email protected]'),
222+
hideRightChevron: true,
223+
url: 'mailto:[email protected]',
224+
),
225+
],
226+
),
235227
CommonStyle.verticalGap,
236-
TableView(headerText: AppLocalizations.of(context)!.about, items: [
237-
TableViewItem(
238-
text: Text(AppLocalizations.of(context)!.version),
239-
rightWidget: FutureBuilder<String>(
240-
future:
241-
PackageInfo.fromPlatform().then((info) => info.version),
242-
builder: (context, snapshot) {
243-
return Text(snapshot.data ?? '');
244-
},
245-
)),
246-
TableViewItem(
247-
text: Text(AppLocalizations.of(context)!.sourceCode),
248-
rightWidget: Text('git-touch/git-touch'),
249-
url: (auth.activeAccount!.platform == PlatformType.github
250-
? '/github'
251-
: 'https://github.com') +
252-
'/git-touch/git-touch',
253-
),
254-
])
228+
TableView(
229+
hasIcon: false,
230+
headerText: AppLocalizations.of(context)!.about,
231+
items: [
232+
TableViewItem(
233+
text: Text(AppLocalizations.of(context)!.version),
234+
rightWidget: FutureBuilder<String>(
235+
future:
236+
PackageInfo.fromPlatform().then((info) => info.version),
237+
builder: (context, snapshot) {
238+
return Text(snapshot.data ?? '');
239+
},
240+
)),
241+
TableViewItem(
242+
text: Text(AppLocalizations.of(context)!.sourceCode),
243+
rightWidget: Text('git-touch/git-touch'),
244+
url: (auth.activeAccount!.platform == PlatformType.github
245+
? '/github'
246+
: 'https://github.com') +
247+
'/git-touch/git-touch',
248+
),
249+
],
250+
),
255251
],
256252
),
257253
);

0 commit comments

Comments
 (0)