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

Merge branch '79-add-settings-page' into 'master'

Resolve "Add "settings" page"

Closes #79

See merge request !74
parents 45fe7ba0 85639c5c
No related branches found
No related tags found
1 merge request!74Resolve "Add "settings" page"
Pipeline #5618 passed
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:unicons/unicons.dart';
import 'package:sudoku/ui/widgets/settings/theme_card.dart';
class SettingsForm extends StatefulWidget {
const SettingsForm({super.key});
@override
State<SettingsForm> createState() => _SettingsFormState();
}
class _SettingsFormState extends State<SettingsForm> {
@override
void dispose() {
super.dispose();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
// Light/dark theme
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Text('settings_label_theme').tr(),
const Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ThemeCard(
mode: ThemeMode.system,
icon: UniconsLine.cog,
),
ThemeCard(
mode: ThemeMode.light,
icon: UniconsLine.sun,
),
ThemeCard(
mode: ThemeMode.dark,
icon: UniconsLine.moon,
)
],
),
],
),
const SizedBox(height: 16),
],
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:sudoku/cubit/theme_cubit.dart';
class ThemeCard extends StatelessWidget {
const ThemeCard({
super.key,
required this.mode,
required this.icon,
});
final IconData icon;
final ThemeMode mode;
@override
Widget build(BuildContext context) {
return BlocBuilder<ThemeCubit, ThemeModeState>(
builder: (BuildContext context, ThemeModeState state) {
return Card(
elevation: 2,
shadowColor: Theme.of(context).colorScheme.shadow,
color: state.themeMode == mode
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.surface,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
margin: const EdgeInsets.all(5),
child: InkWell(
onTap: () => BlocProvider.of<ThemeCubit>(context).getTheme(
ThemeModeState(themeMode: mode),
),
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Icon(
icon,
size: 32,
color: state.themeMode != mode
? Theme.of(context).colorScheme.primary
: Colors.white,
),
),
);
},
);
}
}
...@@ -9,14 +9,6 @@ packages: ...@@ -9,14 +9,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.0" version: "2.5.0"
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
badges: badges:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -192,14 +184,6 @@ packages: ...@@ -192,14 +184,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
overlay_support:
dependency: "direct main"
description:
name: overlay_support
sha256: fc39389bfd94e6985e1e13b2a88a125fc4027608485d2d4e2847afe1b2bb339c
url: "https://pub.dev"
source: hosted
version: "2.1.0"
path: path:
dependency: transitive dependency: transitive
description: description:
...@@ -357,6 +341,14 @@ packages: ...@@ -357,6 +341,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.2" version: "1.3.2"
unicons:
dependency: "direct main"
description:
name: unicons
sha256: dbfcf93ff4d4ea19b324113857e358e4882115ab85db04417a4ba1c72b17a670
url: "https://pub.dev"
source: hosted
version: "2.1.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
......
name: sudoku name: sudoku
description: A sudoku game application. description: A sudoku game application.
publish_to: 'none' publish_to: "none"
version: 0.1.20+69 version: 0.1.21+70
environment: environment:
sdk: '^3.0.0' sdk: "^3.0.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
badges: ^3.1.2 badges: ^3.1.2
easy_localization: ^3.0.1 easy_localization: ^3.0.1
equatable: ^2.0.5 equatable: ^2.0.5
flutter_bloc: ^8.1.1 flutter_bloc: ^8.1.1
hive: ^2.2.3 hive: ^2.2.3
hydrated_bloc: ^9.0.0 hydrated_bloc: ^9.0.0
overlay_support: ^2.1.0
path_provider: ^2.0.11 path_provider: ^2.0.11
unicons: ^2.1.1
dev_dependencies: dev_dependencies:
flutter_lints: ^3.0.1 flutter_lints: ^3.0.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment