Erweiterungen
This commit is contained in:
1 parent
85e973c3dd
commit
fbdd2a4338
14 files changed
+296
-116
No files matched your search
+55
-35
@@ -220,43 +220,63 @@ class Util {
|
||||
}
|
||||
}
|
||||
|
||||
Widget getDefaultButton(String text, Function() onPressed, {Image? image, double? buttonHeight}) {
|
||||
return SizedBox(
|
||||
height: buttonHeight ?? 50,
|
||||
child: MaterialButton(
|
||||
color: const Color.fromARGB(255, 220, 220, 220),
|
||||
disabledColor: Colors.indigo[400],
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15),
|
||||
Widget getDefaultButton(String text, Function() onPressed, {Image? image, double? buttonHeight, bool enabledTimerActive = true, int enabledTimerDelay = 0}) {
|
||||
bool enabledState = enabledTimerActive;
|
||||
|
||||
return StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
if (!enabledState) {
|
||||
Future.delayed(Duration(seconds: enabledTimerDelay), () {
|
||||
enabledState = true;
|
||||
|
||||
if (context.mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
return SizedBox(
|
||||
height: buttonHeight ?? 50,
|
||||
child: MaterialButton(
|
||||
color: const Color.fromARGB(255, 220, 220, 220),
|
||||
disabledColor: const Color.fromARGB(255, 220, 220, 220),
|
||||
disabledElevation: 5,
|
||||
elevation: 5,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(15),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (enabledState) {
|
||||
Util.logInfo("Button \"$text\" clicked");
|
||||
|
||||
onPressed();
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
visible: image != null,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: image,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Opacity(
|
||||
opacity: enabledState ? 1.0 : 0.3,
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(color: Colors.black, fontSize: 14.0),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Util.logInfo("Button \"$text\" clicked");
|
||||
|
||||
onPressed();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
visible: image != null,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: image,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(color: Colors.black, fontSize: 14.0),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
String mapVehicleTypeToImageName(int vehType)
|
||||
|
||||
Reference in new issue
Block a user