Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2024-09-17 14:11:46 +02:00
parent 51ffd59961
commit af6194608d
3 changed files with 62 additions and 9 deletions
+8
View File
@@ -1,3 +1,11 @@
## 1.0.3
* Added the ability to switch back to the normal environment from the debug environment in ArcaneEnvironment
* (breaking) Made the optional `onLoggedOut` callback a Future instead of a void function in ArcaneAuthenticationService
* Added additional error handling to the login method in ArcaneAuthenticationService
* Added support for following the system's theme in ArcaneTheme
* Removed the BuildContext parameter from the `switchTheme` method in ArcaneTheme
## 1.0.2 ## 1.0.2
* Migrated ArcaneAuthenticationService's isSignedIn to a ValueListenable * Migrated ArcaneAuthenticationService's isSignedIn to a ValueListenable
+53 -8
View File
@@ -452,7 +452,7 @@ await Arcane.auth.setDebug();
The Arcane Framework provides a simple interface for managing themes in your application, with dynamic switching between dark and light themes based on the user's system settings, or manually switching between themes. The Arcane Framework provides a simple interface for managing themes in your application, with dynamic switching between dark and light themes based on the user's system settings, or manually switching between themes.
To get started, first register your `ThemeData` objects with the Arcane theme module, then reference the theme in your `MaterialApp` or `CupertinoApp`: To get started, first register your `ThemeData` objects with the Arcane theme module:
```dart ```dart
void main() { void main() {
@@ -463,21 +463,66 @@ void main() {
runApp( runApp(
ArcaneApp( ArcaneApp(
child: MaterialApp( child: MainApp(),
theme: Arcane.theme.light,
darkTheme: Arcane.theme.dark,
themeMode: context.isDarkMode ? ThemeMode.dark : ThemeMode.light,
),
), ),
); );
} }
``` ```
Once configured, you'll have access to theme-related methods and properties: From here, you can either follow the system theme:
```dart
// Follow the system's theme mode
class MainApp extends StatefulWidget {
const MainApp({super.key});
@override
State<MainApp> createState() => _MainAppState();
}
class _MainAppState extends State<MainApp> {
@override
Widget build(BuildContext context) {
return ArcaneApp(
child: MaterialApp(
theme: Arcane.theme.light,
darkTheme: Arcane.theme.dark,
themeMode: Arcane.theme.systemTheme.value,
),
);
}
@override
void didChangeDependencies() {
Arcane.theme.followSystemTheme(context);
super.didChangeDependencies();
}
}
```
or manually control the theme mode:
```dart
// Manually control the theme mode
class MainApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ArcaneApp(
child: MaterialApp(
theme: Arcane.theme.light,
darkTheme: Arcane.theme.dark,
themeMode: Arcane.theme.currentMode,
),
);
}
}
```
Then, you can switch modes whenever you want:
```dart ```dart
// Switch between light and dark themes // Switch between light and dark themes
Arcane.theme.switchTheme(context); Arcane.theme.switchTheme();
// Access current theme data // Access current theme data
final ThemeData currentTheme = Arcane.theme.currentMode == ThemeMode.dark final ThemeData currentTheme = Arcane.theme.currentMode == ThemeMode.dark
+1 -1
View File
@@ -1,6 +1,6 @@
name: arcane_framework name: arcane_framework
description: "Agnostic Reusable Component Architecture for New Ecosystems" description: "Agnostic Reusable Component Architecture for New Ecosystems"
version: 1.0.2 version: 1.0.3
repository: https://github.com/hanskokx/arcane_framework repository: https://github.com/hanskokx/arcane_framework
issue_tracker: https://github.com/hanskokx/arcane_framework/issues issue_tracker: https://github.com/hanskokx/arcane_framework/issues