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/providers/server_data_provider.dart';
|
||||
import 'package:didvan/providers/theme_provider.dart';
|
||||
|
|
@ -41,6 +42,8 @@ class Didvan extends StatelessWidget {
|
|||
color: LightThemeConfig.themeData.primaryColor,
|
||||
themeMode: themeProvider.themeMode,
|
||||
onGenerateRoute: (settings) => RouteGenerator.generateRoute(settings),
|
||||
builder: BotToastInit(), //1. call BotToastInit
|
||||
navigatorObservers: [BotToastNavigatorObserver()],
|
||||
initialRoute: '/',
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
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/theme_data.dart';
|
||||
import 'package:didvan/constants/app_icons.dart';
|
||||
import 'package:didvan/constants/assets.dart';
|
||||
import 'package:didvan/models/enums.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/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rive/rive.dart';
|
||||
|
||||
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 {
|
||||
bool isInit = true;
|
||||
Color backgroundColor;
|
||||
|
|
@ -62,44 +49,71 @@ class ActionSheetUtils {
|
|||
foregroundColor = Theme.of(context).colorScheme.error;
|
||||
break;
|
||||
}
|
||||
await Flushbar(
|
||||
margin: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
borderColor: foregroundColor,
|
||||
BotToast.showNotification(
|
||||
backgroundColor: backgroundColor,
|
||||
borderRadius: DesignConfig.mediumBorderRadius,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
icon: Icon(
|
||||
DidvanIcons.info_circle_solid,
|
||||
color: foregroundColor,
|
||||
title: (cancelFunc) => StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
if (isInit) {
|
||||
Future.delayed(Duration.zero, () {
|
||||
setState(() {});
|
||||
isInit = false;
|
||||
});
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
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,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
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);
|
||||
);
|
||||
// ignore: avoid_single_cascade_in_expression_statements
|
||||
// Flushbar(
|
||||
// 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 {
|
||||
|
|
@ -160,7 +174,7 @@ class ActionSheetUtils {
|
|||
data.onDismissed?.call();
|
||||
},
|
||||
title: data.dismissTitle ?? 'بازگشت',
|
||||
style: ButtonStyleMode.flat,
|
||||
style: ButtonStyleMode.secondary,
|
||||
),
|
||||
),
|
||||
if (data.hasDismissButton) const SizedBox(width: 20),
|
||||
|
|
|
|||
Loading…
Reference in New Issue