D1APP-16 new package configurations
This commit is contained in:
parent
438cd37bb2
commit
dfa957f4fd
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/providers/server_data_provider.dart';
|
import 'package:didvan/providers/server_data_provider.dart';
|
||||||
import 'package:didvan/providers/theme_provider.dart';
|
import 'package:didvan/providers/theme_provider.dart';
|
||||||
|
|
@ -41,6 +42,8 @@ class Didvan extends StatelessWidget {
|
||||||
color: LightThemeConfig.themeData.primaryColor,
|
color: LightThemeConfig.themeData.primaryColor,
|
||||||
themeMode: themeProvider.themeMode,
|
themeMode: themeProvider.themeMode,
|
||||||
onGenerateRoute: (settings) => RouteGenerator.generateRoute(settings),
|
onGenerateRoute: (settings) => RouteGenerator.generateRoute(settings),
|
||||||
|
builder: BotToastInit(), //1. call BotToastInit
|
||||||
|
navigatorObservers: [BotToastNavigatorObserver()],
|
||||||
initialRoute: '/',
|
initialRoute: '/',
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:another_flushbar/flushbar.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
|
||||||
import 'package:didvan/constants/assets.dart';
|
import 'package:didvan/constants/assets.dart';
|
||||||
import 'package:didvan/models/enums.dart';
|
import 'package:didvan/models/enums.dart';
|
||||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
|
|
@ -11,7 +10,6 @@ import 'package:didvan/models/view/alert_data.dart';
|
||||||
import 'package:didvan/widgets/didvan/button.dart';
|
import 'package:didvan/widgets/didvan/button.dart';
|
||||||
import 'package:didvan/widgets/didvan/text.dart';
|
import 'package:didvan/widgets/didvan/text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:rive/rive.dart';
|
import 'package:rive/rive.dart';
|
||||||
|
|
||||||
class ActionSheetUtils {
|
class ActionSheetUtils {
|
||||||
|
|
@ -33,17 +31,6 @@ class ActionSheetUtils {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AnnotatedRegion _customSystemOverlayStyle({required Widget child}) {
|
|
||||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
|
||||||
value: DesignConfig.systemUiOverlayStyle.copyWith(
|
|
||||||
systemNavigationBarColor: DesignConfig
|
|
||||||
.systemUiOverlayStyle.systemNavigationBarColor!
|
|
||||||
.withBlue(20),
|
|
||||||
),
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<void> showAlert(AlertData alertData) async {
|
static Future<void> showAlert(AlertData alertData) async {
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
Color backgroundColor;
|
Color backgroundColor;
|
||||||
|
|
@ -62,20 +49,10 @@ class ActionSheetUtils {
|
||||||
foregroundColor = Theme.of(context).colorScheme.error;
|
foregroundColor = Theme.of(context).colorScheme.error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
await Flushbar(
|
BotToast.showNotification(
|
||||||
margin: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
|
||||||
borderColor: foregroundColor,
|
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
borderRadius: DesignConfig.mediumBorderRadius,
|
title: (cancelFunc) => StatefulBuilder(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
builder: (context, setState) {
|
||||||
icon: Icon(
|
|
||||||
DidvanIcons.info_circle_solid,
|
|
||||||
color: foregroundColor,
|
|
||||||
),
|
|
||||||
shouldIconPulse: true,
|
|
||||||
dismissDirection: FlushbarDismissDirection.HORIZONTAL,
|
|
||||||
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
||||||
messageText: StatefulBuilder(builder: (context, setState) {
|
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
Future.delayed(Duration.zero, () {
|
Future.delayed(Duration.zero, () {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
@ -83,6 +60,7 @@ class ActionSheetUtils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Column(
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
DidvanText(alertData.message, color: foregroundColor),
|
DidvanText(alertData.message, color: foregroundColor),
|
||||||
|
|
@ -94,12 +72,48 @@ class ActionSheetUtils {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
duration: const Duration(seconds: 2),
|
),
|
||||||
boxShadows: [
|
);
|
||||||
BoxShadow(color: Theme.of(context).colorScheme.cardBorder),
|
// ignore: avoid_single_cascade_in_expression_statements
|
||||||
],
|
// Flushbar(
|
||||||
).show(context);
|
// margin: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||||
|
// borderColor: foregroundColor,
|
||||||
|
// backgroundColor: backgroundColor,
|
||||||
|
// borderRadius: DesignConfig.mediumBorderRadius,
|
||||||
|
// padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
|
// icon: Icon(
|
||||||
|
// DidvanIcons.info_circle_solid,
|
||||||
|
// color: foregroundColor,
|
||||||
|
// ),
|
||||||
|
// shouldIconPulse: true,
|
||||||
|
// dismissDirection: FlushbarDismissDirection.HORIZONTAL,
|
||||||
|
// flushbarPosition: FlushbarPosition.BOTTOM,
|
||||||
|
// messageText: StatefulBuilder(builder: (context, setState) {
|
||||||
|
// if (isInit) {
|
||||||
|
// Future.delayed(Duration.zero, () {
|
||||||
|
// setState(() {});
|
||||||
|
// isInit = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// return Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// DidvanText(alertData.message, color: foregroundColor),
|
||||||
|
// AnimatedContainer(
|
||||||
|
// duration: const Duration(seconds: 2),
|
||||||
|
// width: isInit ? MediaQuery.of(context).size.width - 32 : 0,
|
||||||
|
// height: 2,
|
||||||
|
// color: foregroundColor,
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
// duration: const Duration(seconds: 2),
|
||||||
|
// boxShadows: [
|
||||||
|
// BoxShadow(color: Theme.of(context).colorScheme.cardBorder),
|
||||||
|
// ],
|
||||||
|
// )..show(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> showBottomSheet({required ActionSheetData data}) async {
|
static Future<void> showBottomSheet({required ActionSheetData data}) async {
|
||||||
|
|
@ -160,7 +174,7 @@ class ActionSheetUtils {
|
||||||
data.onDismissed?.call();
|
data.onDismissed?.call();
|
||||||
},
|
},
|
||||||
title: data.dismissTitle ?? 'بازگشت',
|
title: data.dismissTitle ?? 'بازگشت',
|
||||||
style: ButtonStyleMode.flat,
|
style: ButtonStyleMode.secondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (data.hasDismissButton) const SizedBox(width: 20),
|
if (data.hasDismissButton) const SizedBox(width: 20),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue