working time
This commit is contained in:
parent
b0f075f2cb
commit
877b6cc393
11 changed files with 833 additions and 144 deletions
15
lib/helpers/extensions/better_when.dart
Normal file
15
lib/helpers/extensions/better_when.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import "package:flight/widgets/loading.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
extension BetterWhen<T> on AsyncValue<T> {
|
||||
Widget betterWhen({
|
||||
required Widget Function(T value) data,
|
||||
Widget Function() loading = Loading.new,
|
||||
}) => when(
|
||||
data: data,
|
||||
error: (error, stackTrace) =>
|
||||
Text("$error: $stackTrace", style: TextStyle(color: Colors.red)),
|
||||
loading: loading,
|
||||
);
|
||||
}
|
||||
13
lib/helpers/extensions/scheme_to_theme.dart
Normal file
13
lib/helpers/extensions/scheme_to_theme.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
extension SchemeToTheme on ColorScheme {
|
||||
ThemeData get theme => ThemeData.from(colorScheme: this).copyWith(
|
||||
textTheme: ThemeData(
|
||||
fontFamilyFallback: ["sans", "emoji"],
|
||||
brightness: brightness,
|
||||
).textTheme,
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue