mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
fix*
This commit is contained in:
parent
43254c2cd9
commit
04a6a50e48
1 changed files with 39 additions and 29 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mangayomi/views/more/settings/appearance/thememode_provider.dart';
|
||||
import 'package:rive/rive.dart';
|
||||
// import 'package:rive/rive.dart';
|
||||
|
||||
class DarkModeButton extends ConsumerStatefulWidget {
|
||||
const DarkModeButton({
|
||||
|
|
@ -13,40 +13,50 @@ class DarkModeButton extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _DarkModeButtonState extends ConsumerState<DarkModeButton> {
|
||||
SMIBool? _bump;
|
||||
// SMIBool? _bump;
|
||||
|
||||
void _onRiveInit(Artboard artboard) {
|
||||
final controller =
|
||||
StateMachineController.fromArtboard(artboard, 'State Machine 1');
|
||||
artboard.addController(controller!);
|
||||
_bump = controller.findInput<bool>('isDark') as SMIBool;
|
||||
_bump?.value = !ref.watch(themeModeProvider);
|
||||
}
|
||||
// void _onRiveInit(Artboard artboard) {
|
||||
// final controller =
|
||||
// StateMachineController.fromArtboard(artboard, 'State Machine 1');
|
||||
// artboard.addController(controller!);
|
||||
// _bump = controller.findInput<bool>('isDark') as SMIBool;
|
||||
// _bump?.value = !ref.watch(themeModeProvider);
|
||||
// }
|
||||
|
||||
void _hitBump(bool value) => _bump?.value = value;
|
||||
// void _hitBump(bool value) => _bump?.value = value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool isLight = ref.watch(themeModeProvider);
|
||||
_hitBump(!isLight);
|
||||
// _hitBump(!isLight);
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
if (!isLight == true) {
|
||||
ref.read(themeModeProvider.notifier).setLightTheme();
|
||||
} else {
|
||||
ref.read(themeModeProvider.notifier).setDarkTheme();
|
||||
}
|
||||
},
|
||||
title: const Text("Theme mode"),
|
||||
subtitle: Text(ref.watch(themeModeProvider) ? 'Light' : 'Dark'),
|
||||
trailing: SizedBox(
|
||||
height: 80,
|
||||
width: 80,
|
||||
child: RiveAnimation.asset(
|
||||
'assets/switch.riv',
|
||||
onInit: _onRiveInit,
|
||||
),
|
||||
),
|
||||
);
|
||||
onTap: () {
|
||||
if (!isLight == true) {
|
||||
ref.read(themeModeProvider.notifier).setLightTheme();
|
||||
} else {
|
||||
ref.read(themeModeProvider.notifier).setDarkTheme();
|
||||
}
|
||||
},
|
||||
title: const Text("Theme mode"),
|
||||
subtitle: Text(ref.watch(themeModeProvider) ? 'Light' : 'Dark'),
|
||||
trailing: Switch(
|
||||
value: !isLight,
|
||||
onChanged: (dd) {
|
||||
if (!isLight == true) {
|
||||
ref.read(themeModeProvider.notifier).setLightTheme();
|
||||
} else {
|
||||
ref.read(themeModeProvider.notifier).setDarkTheme();
|
||||
}
|
||||
})
|
||||
|
||||
// SizedBox(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// child: RiveAnimation.asset(
|
||||
// 'assets/switch.riv',
|
||||
// onInit: _onRiveInit,
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue