account settings

This commit is contained in:
wgh19
2024-05-14 22:43:45 +08:00
parent a8b0495fc6
commit f8c3514956
3 changed files with 114 additions and 3 deletions

View File

@@ -7,9 +7,11 @@ void showToast(BuildContext context, {required String message, IconData? icon})
var newEntry = OverlayEntry(
builder: (context) => ToastOverlay(message: message, icon: icon));
OverlayWidget.of(context)?.addOverlay(newEntry);
var overlay = OverlayWidget.of(context);
Timer(const Duration(seconds: 2), () => OverlayWidget.of(context)?.remove(newEntry));
overlay?.addOverlay(newEntry);
Timer(const Duration(seconds: 2), () => overlay?.remove(newEntry));
}
class ToastOverlay extends StatelessWidget {

View File

@@ -23,3 +23,29 @@ class TitleBar extends StatelessWidget {
);
}
}
class SliverTitleBar extends StatelessWidget {
const SliverTitleBar({required this.title, this.action, super.key});
final String title;
final Widget? action;
@override
Widget build(BuildContext context) {
return SliverToBoxAdapter(
child: SizedBox(
child: Row(
children: [
Text(title,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
const Spacer(),
if(action != null)
action!
],
).paddingHorizontal(16).paddingVertical(8),
),
);
}
}