Skip to content
Snippets Groups Projects
Commit 06962138 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Improve settings page

parent adbbe332
No related branches found
No related tags found
1 merge request!46Resolve "Improve settings page"
Pipeline #4714 passed
This commit is part of merge request !46. Comments created here will be created in the context of that merge request.
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.45 app.versionName=0.0.46
app.versionCode=45 app.versionCode=46
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
"settings_title": "Settings", "settings_title": "Settings",
"settings_label_username": "Username: ", "settings_label_username": "Username: ",
"settings_label_security_token": "Security token: ", "settings_label_security_token": "Security token: ",
"settings_title_days_count": "Days counts: ",
"settings_label_discoveries_days_count": "Discoveries: ", "settings_label_discoveries_days_count": "Discoveries: ",
"settings_label_distribution_days_count": "Distributions : ", "settings_label_distribution_days_count": "Distributions (by day/hour) : ",
"settings_label_statistics_recent_days_count": "Recent statistics: ", "settings_label_statistics_recent_days_count": "Statistics: ",
"settings_label_timeline_days_count": "Timeline: ", "settings_label_timeline_days_count": "Global timeline: ",
"settings_label_top_artists_days_count": "Top Artists: ", "settings_label_top_artists_days_count": "Top Artists: ",
"settings_button_save": "Save", "settings_button_save": "Save",
......
...@@ -28,10 +28,11 @@ ...@@ -28,10 +28,11 @@
"settings_title": "Paramètres", "settings_title": "Paramètres",
"settings_label_username": "Utilisateur : ", "settings_label_username": "Utilisateur : ",
"settings_label_security_token": "Jeton de sécurité : ", "settings_label_security_token": "Jeton de sécurité : ",
"settings_title_days_count": "Nombre de jours : ",
"settings_label_discoveries_days_count": "Découvertes : ", "settings_label_discoveries_days_count": "Découvertes : ",
"settings_label_distribution_days_count": "Répartitions : ", "settings_label_distribution_days_count": "Répartitions (par jour/heure) : ",
"settings_label_statistics_recent_days_count": "Statistiques récentes : ", "settings_label_statistics_recent_days_count": "Statistiques : ",
"settings_label_timeline_days_count": "Timeline : ", "settings_label_timeline_days_count": "Timeline globale : ",
"settings_label_top_artists_days_count": "Top Artistes : ", "settings_label_top_artists_days_count": "Top Artistes : ",
"settings_button_save": "Enregistrer", "settings_button_save": "Enregistrer",
......
Improve settings page.
Améliorations sur la page des paramètres.
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:scrobbles/ui/widgets/header_app.dart'; import 'package:scrobbles/ui/widgets/app_titles.dart';
import 'package:scrobbles/ui/widgets/settings_form.dart'; import 'package:scrobbles/ui/widgets/settings_form.dart';
class ScreenSettings extends StatelessWidget { class ScreenSettings extends StatelessWidget {
...@@ -14,8 +15,9 @@ class ScreenSettings extends StatelessWidget { ...@@ -14,8 +15,9 @@ class ScreenSettings extends StatelessWidget {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
SizedBox(height: 8), SizedBox(height: 8),
AppHeader(text: 'settings_title'), AppTitle1(text: tr('settings_title')),
SizedBox(height: 8), SizedBox(height: 8),
AppTitle2(text: tr('settings_title_days_count')),
SettingsForm(), SettingsForm(),
], ],
); );
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:unicons/unicons.dart'; import 'package:unicons/unicons.dart';
import 'package:scrobbles/ui/widgets/header_app.dart'; import 'package:scrobbles/ui/widgets/app_titles.dart';
class StandardAppBar extends StatelessWidget implements PreferredSizeWidget { class StandardAppBar extends StatelessWidget implements PreferredSizeWidget {
final Function() notifyParent; final Function() notifyParent;
...@@ -11,7 +11,7 @@ class StandardAppBar extends StatelessWidget implements PreferredSizeWidget { ...@@ -11,7 +11,7 @@ class StandardAppBar extends StatelessWidget implements PreferredSizeWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( return AppBar(
title: const AppHeader(text: 'app_name'), title: const AppTitle(text: 'app_name'),
actions: [ actions: [
IconButton( IconButton(
onPressed: () { onPressed: () {
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class AppTitle extends StatelessWidget {
const AppTitle({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
tr(text),
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineLarge!.apply(fontWeightDelta: 2),
);
}
}
class AppTitle1 extends StatelessWidget {
const AppTitle1({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
text,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.titleLarge!.apply(fontWeightDelta: 2),
);
}
}
class AppTitle2 extends StatelessWidget {
const AppTitle2({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
text,
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.titleMedium!.apply(fontWeightDelta: 2),
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:scrobbles/ui/widgets/app_titles.dart';
class CardContent extends StatelessWidget { class CardContent extends StatelessWidget {
const CardContent({ const CardContent({
...@@ -35,11 +36,7 @@ class CardContent extends StatelessWidget { ...@@ -35,11 +36,7 @@ class CardContent extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( AppTitle1(text: this.title),
this.title,
style:
Theme.of(context).primaryTextTheme.titleLarge!.apply(fontWeightDelta: 2),
),
this.loader, this.loader,
], ],
), ),
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class AppHeader extends StatelessWidget {
const AppHeader({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
tr(text),
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2),
);
}
}
...@@ -101,121 +101,121 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -101,121 +101,121 @@ class _SettingsFormState extends State<SettingsForm> {
// ), // ),
// SizedBox(height: 20), // SizedBox(height: 20),
// Discoveries // Statistics (recent)
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('settings_label_discoveries_days_count').tr(), Text('settings_label_statistics_recent_days_count').tr(),
ToggleButtons( ToggleButtons(
onPressed: (int index) { onPressed: (int index) {
setState(() { setState(() {
discoveriesDaysCount = DefaultSettings.allowedValues[index]; statisticsRecentDaysCount = DefaultSettings.allowedValues[index];
for (int i = 0; i < _selectedDiscoveriesDaysCount.length; i++) { for (int i = 0; i < _selectedStatisticsRecentDaysCount.length; i++) {
_selectedDiscoveriesDaysCount[i] = i == index; _selectedStatisticsRecentDaysCount[i] = i == index;
} }
}); });
saveSettings(); saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
isSelected: _selectedDiscoveriesDaysCount, isSelected: _selectedStatisticsRecentDaysCount,
children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(), children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(),
), ),
], ],
), ),
// Distribution by day/hour + heatmap // Timeline
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('settings_label_distribution_days_count').tr(), Text('settings_label_timeline_days_count').tr(),
ToggleButtons( ToggleButtons(
onPressed: (int index) { onPressed: (int index) {
setState(() { setState(() {
distributionDaysCount = DefaultSettings.allowedValues[index]; timelineDaysCount = DefaultSettings.allowedValues[index];
for (int i = 0; i < _selectedDistributionDaysCount.length; i++) { for (int i = 0; i < _selectedTimelineDaysCount.length; i++) {
_selectedDistributionDaysCount[i] = i == index; _selectedTimelineDaysCount[i] = i == index;
} }
}); });
saveSettings(); saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
isSelected: _selectedDistributionDaysCount, isSelected: _selectedTimelineDaysCount,
children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(), children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(),
), ),
], ],
), ),
// Statistics (recent) // Top Artists
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('settings_label_statistics_recent_days_count').tr(), Text('settings_label_top_artists_days_count').tr(),
ToggleButtons( ToggleButtons(
onPressed: (int index) { onPressed: (int index) {
setState(() { setState(() {
statisticsRecentDaysCount = DefaultSettings.allowedValues[index]; topArtistsDaysCount = DefaultSettings.allowedValues[index];
for (int i = 0; i < _selectedStatisticsRecentDaysCount.length; i++) { for (int i = 0; i < _selectedTopArtistsDaysCount.length; i++) {
_selectedStatisticsRecentDaysCount[i] = i == index; _selectedTopArtistsDaysCount[i] = i == index;
} }
}); });
saveSettings(); saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
isSelected: _selectedStatisticsRecentDaysCount, isSelected: _selectedTopArtistsDaysCount,
children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(), children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(),
), ),
], ],
), ),
// Timeline // Discoveries
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('settings_label_timeline_days_count').tr(), Text('settings_label_discoveries_days_count').tr(),
ToggleButtons( ToggleButtons(
onPressed: (int index) { onPressed: (int index) {
setState(() { setState(() {
timelineDaysCount = DefaultSettings.allowedValues[index]; discoveriesDaysCount = DefaultSettings.allowedValues[index];
for (int i = 0; i < _selectedTimelineDaysCount.length; i++) { for (int i = 0; i < _selectedDiscoveriesDaysCount.length; i++) {
_selectedTimelineDaysCount[i] = i == index; _selectedDiscoveriesDaysCount[i] = i == index;
} }
}); });
saveSettings(); saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
isSelected: _selectedTimelineDaysCount, isSelected: _selectedDiscoveriesDaysCount,
children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(), children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(),
), ),
], ],
), ),
// Top Artists // Distribution by day/hour + heatmap
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('settings_label_top_artists_days_count').tr(), Text('settings_label_distribution_days_count').tr(),
ToggleButtons( ToggleButtons(
onPressed: (int index) { onPressed: (int index) {
setState(() { setState(() {
topArtistsDaysCount = DefaultSettings.allowedValues[index]; distributionDaysCount = DefaultSettings.allowedValues[index];
for (int i = 0; i < _selectedTopArtistsDaysCount.length; i++) { for (int i = 0; i < _selectedDistributionDaysCount.length; i++) {
_selectedTopArtistsDaysCount[i] = i == index; _selectedDistributionDaysCount[i] = i == index;
} }
}); });
saveSettings(); saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
isSelected: _selectedTopArtistsDaysCount, isSelected: _selectedDistributionDaysCount,
children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(), children: DefaultSettings.allowedValues.map((e) => Text(e.toString())).toList(),
), ),
], ],
......
...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts ...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none' publish_to: 'none'
version: 0.0.45+45 version: 0.0.46+46
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment