Commit 585abe2f authored by Lukas Arnold's avatar Lukas Arnold
Browse files

Merge branch 'f40-rework-settings-screen-from-mockup' into 'dev'

Changes the settings screen to fit the Mockup specifications.

Closes #79

See merge request !67
parents 14eddb39 64e05176
Pipeline #631144 passed with stage
in 1 minute and 32 seconds
...@@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; ...@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
//*********************************************** //***********************************************
//***** Custom Imports ******* //***** Custom Imports *******
...@@ -39,6 +38,11 @@ class _SettingsScreenState extends State<SettingsScreen> { ...@@ -39,6 +38,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
/// An instance of [AppSetting] /// An instance of [AppSetting]
late AppSetting appSetting; late AppSetting appSetting;
/// Colors for the visible Buttons
final brightButtonColor = Colors.grey[500]!;
final normalButtonColor = Colors.grey[600]!;
final darkButtonColor = Colors.grey[700]!;
//*************************************************** //***************************************************
//****** Main Widget ********* //****** Main Widget *********
//*************************************************** //***************************************************
...@@ -46,40 +50,69 @@ class _SettingsScreenState extends State<SettingsScreen> { ...@@ -46,40 +50,69 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
appSetting = Provider.of<AppSetting>(context); appSetting = Provider.of<AppSetting>(context);
final artworkService = Provider.of<ArtworkService>(context); final artworkService = Provider.of<ArtworkService>(context);
return Padding( return Column(
padding: const EdgeInsets.only(top: 10.0), children: [
child: Center( Flexible(
child: StaggeredGridView.count( child: Row(
crossAxisCount: 4, children: [
crossAxisSpacing: 1, Flexible(
mainAxisSpacing: 1, child: createButtons(
children: <Widget>[ AppLocalizations.of(context)!.aboutus.toUpperCase(),
createButtons(AppLocalizations.of(context)!.aboutus.toUpperCase(), artworkService.appInfo.aboutUs,
artworkService.appInfo.aboutUs, Colors.grey), normalButtonColor),
createButtons(AppLocalizations.of(context)!.aboutart.toUpperCase(), ),
artworkService.appInfo.aboutTUArt, Colors.grey[600]!), Flexible(
createButtons(AppLocalizations.of(context)!.colors.toUpperCase(), child: createButtons(
"", Colors.grey[600]!), AppLocalizations.of(context)!.aboutart.toUpperCase(),
createButtons(AppLocalizations.of(context)!.sizes.toUpperCase(), "", artworkService.appInfo.aboutTUArt,
Colors.grey), brightButtonColor),
createButtons(AppLocalizations.of(context)!.favorites.toUpperCase(), ),
"", Colors.grey), ],
createButtons(AppLocalizations.of(context)!.lang.toUpperCase(), "", ),
Colors.grey[600]!),
createButtons(AppLocalizations.of(context)!.about.toUpperCase(),
artworkService.appInfo.imprint, Colors.grey[600]!),
],
staggeredTiles: const <StaggeredTile>[
StaggeredTile.count(2, 1.3),
StaggeredTile.count(2, 1.3),
StaggeredTile.count(2, 1.3),
StaggeredTile.count(2, 1.3),
StaggeredTile.count(2, 1.3),
StaggeredTile.count(2, 1.3),
StaggeredTile.count(4, 1.3),
],
), ),
), Flexible(
child: Row(
children: [
Flexible(
child: createButtons(
AppLocalizations.of(context)!.colors.toUpperCase(),
"",
brightButtonColor),
),
Flexible(
child: createButtons(
AppLocalizations.of(context)!.sizes.toUpperCase(),
"",
normalButtonColor),
),
],
),
),
Flexible(
child: Row(
children: [
Flexible(
child: createButtons(
AppLocalizations.of(context)!.favorites.toUpperCase(),
"",
normalButtonColor),
),
Flexible(
child: createButtons(
AppLocalizations.of(context)!.lang.toUpperCase(),
"",
brightButtonColor),
),
],
),
),
Flexible(
child: createButtons(
AppLocalizations.of(context)!.about.toUpperCase(),
artworkService.appInfo.imprint,
darkButtonColor),
),
],
); );
} }
...@@ -96,30 +129,23 @@ class _SettingsScreenState extends State<SettingsScreen> { ...@@ -96,30 +129,23 @@ class _SettingsScreenState extends State<SettingsScreen> {
Widget createButtons(String text, String infoText, Color color, Widget createButtons(String text, String infoText, Color color,
{void Function()? onPressed}) { {void Function()? onPressed}) {
appSetting = Provider.of<AppSetting>(context); appSetting = Provider.of<AppSetting>(context);
return Padding( return TextButton(
padding: const EdgeInsets.all(1.0), onPressed: () {
child: ElevatedButton( showOptionDialog(text, infoText);
onPressed: () { },
showOptionDialog(text, infoText); style: ButtonStyle(
}, shape: MaterialStateProperty.all<RoundedRectangleBorder>(
style: ButtonStyle( RoundedRectangleBorder(borderRadius: BorderRadius.zero)),
backgroundColor: MaterialStateProperty.all<Color>(color), backgroundColor: MaterialStateProperty.all<Color>(color),
elevation: MaterialStateProperty.resolveWith<double>( splashFactory: NoSplash.splashFactory),
(Set<MaterialState> states) { child: Align(
if (states.contains(MaterialState.pressed) || alignment: Alignment(-1, -0.75),
states.contains(MaterialState.disabled)) { child: Padding(
return 0; padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
} child: AutoSizeText(text,
return 10; style: Theme.of(context).textTheme.button!.copyWith(
}, fontSize: appSetting.buttonTextFontSize, color: Colors.white),
)), textAlign: TextAlign.left),
child: Center(
child: AutoSizeText(
text,
style: Theme.of(context).textTheme.button!.copyWith(
fontSize: appSetting.buttonTextFontSize, color: Colors.white),
textAlign: TextAlign.center,
),
), ),
), ),
); );
......
...@@ -235,13 +235,6 @@ packages: ...@@ -235,13 +235,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.2" version: "1.3.2"
flutter_staggered_grid_view:
dependency: "direct main"
description:
name: flutter_staggered_grid_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
......
...@@ -33,7 +33,6 @@ dependencies: ...@@ -33,7 +33,6 @@ dependencies:
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
smooth_page_indicator: ^1.0.0+2 smooth_page_indicator: ^1.0.0+2
flutter_staggered_grid_view: ^0.4.1
http: ^0.13.4 http: ^0.13.4
qr_code_scanner: ^0.6.1 qr_code_scanner: ^0.6.1
flutter_map: ^0.14.0 flutter_map: ^0.14.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment