Skip to content

Commit

Permalink
feat: Adapt style for settings, more (closes #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Dec 23, 2023
1 parent 589c8d2 commit 27f3c3b
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 315 deletions.
2 changes: 2 additions & 0 deletions wrestling_scoreboard_client/lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"more": "Mehr",
"settings": "Einstellungen",
"general": "Allgemein",
"network": "Netzwerk",
"scoreboard": "Anzeigetafel",
"systemSetting": "Systemeinstellung",
"language": "Sprache",
"de_DE": "Deutsch",
Expand Down
2 changes: 2 additions & 0 deletions wrestling_scoreboard_client/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"more": "More",
"settings": "Settings",
"general": "General",
"network": "Network",
"scoreboard": "Scoreboard",
"systemSetting": "System setting",
"language": "Language",
"de_DE": "German",
Expand Down
17 changes: 17 additions & 0 deletions wrestling_scoreboard_client/lib/ui/components/card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';

class PaddedCard extends StatelessWidget {
final Widget child;

const PaddedCard({required this.child, super.key});

@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: child,
),
);
}
}
29 changes: 13 additions & 16 deletions wrestling_scoreboard_client/lib/ui/components/exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:wrestling_scoreboard_client/ui/components/card.dart';

class ExceptionWidget extends StatelessWidget {
final Object exception;
Expand All @@ -17,22 +18,18 @@ class ExceptionWidget extends StatelessWidget {
)
: SelectableText(exception.toString(), style: TextStyle(color: Theme.of(context).colorScheme.error));
return Center(
child: Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Wrap(children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
errorText,
if (onRetry != null) const SizedBox(height: 16),
if (onRetry != null)
OutlinedButton(onPressed: onRetry, child: Text(AppLocalizations.of(context)!.retry))
],
),
]),
),
child: PaddedCard(
child: Wrap(children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
errorText,
if (onRetry != null) const SizedBox(height: 16),
if (onRetry != null) OutlinedButton(onPressed: onRetry, child: Text(AppLocalizations.of(context)!.retry))
],
),
]),
),
);
}
Expand Down
184 changes: 89 additions & 95 deletions wrestling_scoreboard_client/lib/ui/more/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:http/http.dart' as http;
import 'package:url_launcher/url_launcher.dart';
import 'package:wrestling_scoreboard_client/main.dart';
import 'package:wrestling_scoreboard_client/ui/components/card.dart';
import 'package:wrestling_scoreboard_client/ui/components/responsive_container.dart';

const loadCompleteChangelog = false;
Expand Down Expand Up @@ -38,107 +39,100 @@ class AboutScreen extends StatelessWidget {
appBar: AppBar(title: Text(localizations.about)),
body: ResponsiveColumn(
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
title: Text(
localizations.about_Application,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
leading: Image.asset('assets/images/icons/launcher.png'),
title: Text(localizations.appName),
subtitle: Text('Version: ${packageInfo.version}+${packageInfo.buildNumber}'),
),
const Divider(),
ListTile(
leading: const Icon(Icons.list),
title: Text(localizations.about_Changelog),
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
actions: [
TextButton(
child: Text(localizations.ok),
onPressed: () => Navigator.of(context).pop(),
),
],
content: FutureBuilder(
future: _loadChangelog(),
builder: (context, snapshot) {
return snapshot.hasData
? SingleChildScrollView(
child: MarkdownBody(
listItemCrossAxisAlignment: MarkdownListItemCrossAxisAlignment.start,
shrinkWrap: true,
selectable: true,
data: snapshot.data!,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
)
: const Center(child: CircularProgressIndicator());
},
),
),
),
),
const Divider(),
ListTile(
leading: const Icon(Icons.api),
title: Text(localizations.about_Licenses),
onTap: () => navigateTo(LicensePage(
applicationName: localizations.appName,
applicationIcon: Image.asset('assets/images/icons/launcher.png'),
applicationVersion: '${packageInfo.version}+${packageInfo.buildNumber}',
)),
),
],
PaddedCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
title: Text(
localizations.about_Application,
style: Theme.of(context).textTheme.headlineSmall,
)),
),
Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
children: [
ListTile(
title: Text(
localizations.about_Contact,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.about_contact_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
ListTile(
leading: Image.asset('assets/images/icons/launcher.png'),
title: Text(localizations.appName),
subtitle: Text('Version: ${packageInfo.version}+${packageInfo.buildNumber}'),
),
const Divider(),
ListTile(
leading: const Icon(Icons.list),
title: Text(localizations.about_Changelog),
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
actions: [
TextButton(
child: Text(localizations.ok),
onPressed: () => Navigator.of(context).pop(),
),
],
content: FutureBuilder(
future: _loadChangelog(),
builder: (context, snapshot) {
return snapshot.hasData
? SingleChildScrollView(
child: MarkdownBody(
listItemCrossAxisAlignment: MarkdownListItemCrossAxisAlignment.start,
shrinkWrap: true,
selectable: true,
data: snapshot.data!,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
)
: const Center(child: CircularProgressIndicator());
},
),
],
))),
Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
children: [
ListTile(
title: Text(
localizations.about_Development,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.about_development_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
),
],
),
const Divider(),
ListTile(
leading: const Icon(Icons.api),
title: Text(localizations.about_Licenses),
onTap: () => navigateTo(LicensePage(
applicationName: localizations.appName,
applicationIcon: Image.asset('assets/images/icons/launcher.png'),
applicationVersion: '${packageInfo.version}+${packageInfo.buildNumber}',
)),
),
],
),
),
PaddedCard(
child: Column(
children: [
ListTile(
title: Text(
localizations.about_Contact,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.about_contact_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
),
],
)),
PaddedCard(
child: Column(
children: [
ListTile(
title: Text(
localizations.about_Development,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.about_development_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
),
],
),
),
],
Expand Down
36 changes: 17 additions & 19 deletions wrestling_scoreboard_client/lib/ui/more/imprint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:wrestling_scoreboard_client/ui/components/card.dart';
import 'package:wrestling_scoreboard_client/ui/components/responsive_container.dart';

class ImprintScreen extends StatelessWidget {
Expand All @@ -14,26 +15,23 @@ class ImprintScreen extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(localizations.imprint)),
body: ResponsiveScrollView(
child: Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
children: [
ListTile(
title: Text(
localizations.imprint,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.imprint_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
child: PaddedCard(
child: Column(
children: [
ListTile(
title: Text(
localizations.imprint,
style: Theme.of(context).textTheme.headlineSmall,
)),
ListTile(
title: MarkdownBody(
shrinkWrap: true,
selectable: true,
data: localizations.imprint_phrase,
onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)),
),
],
),
),
],
),
),
),
Expand Down
50 changes: 28 additions & 22 deletions wrestling_scoreboard_client/lib/ui/more/more.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,34 @@ class MoreScreen extends StatelessWidget {
);
}

return ResponsiveScrollView(
child: Card(
child: Column(
children: [
ListTile(
leading: const Icon(Icons.settings),
title: Text(localizations.settings),
onTap: () => navigateTo(const CustomSettingsScreen()),
),
const Divider(),
ListTile(
leading: const Icon(Icons.info),
title: Text(localizations.imprint),
onTap: () => navigateTo(const ImprintScreen()),
),
const Divider(),
ListTile(
leading: const Icon(Icons.info),
title: Text(localizations.about),
onTap: () => navigateTo(const AboutScreen()),
),
],
return Scaffold(
appBar: AppBar(title: Text(localizations.more)),
body: ResponsiveScrollView(
child: Card(
child: Column(
children: ListTile.divideTiles(
context: context,
tiles: [
ListTile(
leading: const Icon(Icons.settings),
title: Text(localizations.settings),
onTap: () => navigateTo(const CustomSettingsScreen()),
),
const Divider(height: 0),
ListTile(
leading: const Icon(Icons.info),
title: Text(localizations.imprint),
onTap: () => navigateTo(const ImprintScreen()),
),
const Divider(height: 0),
ListTile(
leading: const Icon(Icons.info),
title: Text(localizations.about),
onTap: () => navigateTo(const AboutScreen()),
),
],
).toList(),
),
),
),
);
Expand Down
Loading

0 comments on commit 27f3c3b

Please sign in to comment.