opt.: backup

This commit is contained in:
lollipopkit
2023-09-13 13:05:19 +08:00
parent 9ce7138d9b
commit 269c2a0a10
37 changed files with 535 additions and 632 deletions

View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import '../../core/persistant_store.dart';
class StoreSwitch extends StatelessWidget {
final StorePropertyBase<bool> prop;
final void Function(bool)? func;
const StoreSwitch({super.key, required this.prop, this.func});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder(
valueListenable: prop.listenable(),
builder: (context, bool value, widget) {
return Switch(
value: value,
onChanged: (value) {
func?.call(value);
prop.put(value);
},
);
},
);
}
}