mirror of
https://github.com/Iconica-Development/flutter_dialogs.git
synced 2025-05-18 10:53:45 +02:00
fix: add CI and linter
This commit is contained in:
parent
d9f7b51336
commit
fcd23e78b6
10 changed files with 269 additions and 252 deletions
14
.github/workflows/component-ci.yml
vendored
Normal file
14
.github/workflows/component-ci.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
name: Iconica Standard Component CI Workflow
|
||||
# Workflow Caller version: 2.0.0
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-global-iconica-workflow:
|
||||
uses: Iconica-Development/.github/.github/workflows/component-ci.yml@master
|
||||
secrets: inherit
|
||||
permissions: write-all
|
||||
with:
|
||||
subfolder: "." # add optional subfolder to run workflow in
|
|
@ -1,3 +1,7 @@
|
|||
## 0.0.2
|
||||
|
||||
- Added CI and linter
|
||||
|
||||
## 0.0.1
|
||||
|
||||
- Initial port
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
include: package:flutter_lints/flutter.yaml
|
||||
include: package:flutter_iconica_analysis/analysis_options.yaml
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
# Possible to overwrite the rules from the package
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
|
||||
linter:
|
||||
rules:
|
|
@ -1,10 +1,10 @@
|
|||
// SPDX-FileCopyrightText: 2022 Iconica
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
///
|
||||
library flutter_dialogs;
|
||||
|
||||
export './src/dialogs.dart';
|
||||
export './src/popup_service.dart';
|
||||
export './src/popup_parent.dart';
|
||||
export './src/alert_dialogs.dart';
|
||||
export './src/dialogs.dart';
|
||||
export './src/popup_parent.dart';
|
||||
export './src/popup_service.dart';
|
||||
|
|
|
@ -5,20 +5,19 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AlertDialogAction {
|
||||
final String text;
|
||||
final bool primary;
|
||||
final bool secondary;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
AlertDialogAction({
|
||||
required this.text,
|
||||
required this.onPressed,
|
||||
this.primary = false,
|
||||
this.secondary = false,
|
||||
required this.onPressed,
|
||||
}) : assert(
|
||||
!(primary && secondary),
|
||||
"AlertDialogAction can't be primary and secondary at the same time",
|
||||
);
|
||||
final String text;
|
||||
final bool primary;
|
||||
final bool secondary;
|
||||
final VoidCallback onPressed;
|
||||
}
|
||||
|
||||
typedef ButtonCallback = Widget Function(
|
||||
|
@ -33,13 +32,6 @@ typedef IconButtonCallback = Widget Function(
|
|||
);
|
||||
|
||||
class IconicaAlertDialog extends StatelessWidget {
|
||||
final List<AlertDialogAction> buttons;
|
||||
final WidgetBuilder body;
|
||||
final bool? closeButton;
|
||||
final ButtonCallback? primaryButton;
|
||||
final ButtonCallback? secondaryButton;
|
||||
final IconButtonCallback? iconButton;
|
||||
|
||||
const IconicaAlertDialog._({
|
||||
required this.buttons,
|
||||
required this.body,
|
||||
|
@ -59,23 +51,22 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog.multiButton(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
buttons: [
|
||||
AlertDialogAction(
|
||||
text: buttonText,
|
||||
onPressed: onPressed,
|
||||
primary: primary,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
IconicaAlertDialog.multiButton(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
buttons: [
|
||||
AlertDialogAction(
|
||||
text: buttonText,
|
||||
onPressed: onPressed,
|
||||
primary: primary,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.multiButton({
|
||||
required String title,
|
||||
|
@ -85,40 +76,39 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog._(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (context) => Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
}) =>
|
||||
IconicaAlertDialog._(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (context) => Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.headline6?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).textTheme.bodyText2?.color,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
|
||||
child: Text(
|
||||
body,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
|
||||
child: Text(
|
||||
body,
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.icon({
|
||||
required String title,
|
||||
|
@ -129,38 +119,37 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog._(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (context) => Column(
|
||||
children: [
|
||||
icon,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.headline6?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
}) =>
|
||||
IconicaAlertDialog._(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (context) => Column(
|
||||
children: [
|
||||
icon,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
|
||||
child: Text(
|
||||
body,
|
||||
style: Theme.of(context).textTheme.bodyText2,
|
||||
textAlign: TextAlign.center,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
|
||||
child: Text(
|
||||
body,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.yesOrNo({
|
||||
required String title,
|
||||
|
@ -173,17 +162,16 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog.multiButton(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
IconicaAlertDialog.multiButton(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.yesOrNoIcon({
|
||||
required String title,
|
||||
|
@ -197,18 +185,17 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog.icon(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
icon: icon,
|
||||
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
IconicaAlertDialog.icon(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
body: body,
|
||||
icon: icon,
|
||||
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.singleButtonIcon({
|
||||
required String title,
|
||||
|
@ -222,25 +209,24 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog.icon(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
icon: icon,
|
||||
body: body,
|
||||
buttons: [
|
||||
AlertDialogAction(
|
||||
text: buttonText,
|
||||
primary: primary,
|
||||
secondary: secondary,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
IconicaAlertDialog.icon(
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
closeButton: closeButton,
|
||||
title: title,
|
||||
icon: icon,
|
||||
body: body,
|
||||
buttons: [
|
||||
AlertDialogAction(
|
||||
text: buttonText,
|
||||
primary: primary,
|
||||
secondary: secondary,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
factory IconicaAlertDialog.custom({
|
||||
required Widget body,
|
||||
|
@ -249,16 +235,21 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
ButtonCallback? primaryButton,
|
||||
ButtonCallback? secondaryButton,
|
||||
IconButtonCallback? iconButton,
|
||||
}) {
|
||||
return IconicaAlertDialog._(
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (_) => body,
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
IconicaAlertDialog._(
|
||||
closeButton: closeButton,
|
||||
buttons: buttons,
|
||||
body: (_) => body,
|
||||
primaryButton: primaryButton,
|
||||
secondaryButton: secondaryButton,
|
||||
iconButton: iconButton,
|
||||
);
|
||||
final List<AlertDialogAction> buttons;
|
||||
final WidgetBuilder body;
|
||||
final bool? closeButton;
|
||||
final ButtonCallback? primaryButton;
|
||||
final ButtonCallback? secondaryButton;
|
||||
final IconButtonCallback? iconButton;
|
||||
|
||||
static List<AlertDialogAction> _getYesNoDialogButtons(
|
||||
bool focusYes,
|
||||
|
@ -267,49 +258,47 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
VoidCallback onNo, {
|
||||
String no = 'No',
|
||||
String yes = 'Yes',
|
||||
}) {
|
||||
return <AlertDialogAction>[
|
||||
if (focusYes) ...[
|
||||
}) =>
|
||||
<AlertDialogAction>[
|
||||
if (focusYes) ...[
|
||||
AlertDialogAction(
|
||||
text: no,
|
||||
primary: !focusYes,
|
||||
secondary: !focusYes && otherSecondary,
|
||||
onPressed: onNo,
|
||||
),
|
||||
],
|
||||
AlertDialogAction(
|
||||
text: no,
|
||||
primary: !focusYes,
|
||||
text: yes,
|
||||
primary: focusYes,
|
||||
secondary: !focusYes && otherSecondary,
|
||||
onPressed: onNo,
|
||||
onPressed: onYes,
|
||||
),
|
||||
],
|
||||
AlertDialogAction(
|
||||
text: yes,
|
||||
primary: focusYes,
|
||||
secondary: !focusYes && otherSecondary,
|
||||
onPressed: onYes,
|
||||
),
|
||||
if (!focusYes) ...[
|
||||
AlertDialogAction(
|
||||
text: no,
|
||||
primary: !focusYes,
|
||||
secondary: focusYes && otherSecondary,
|
||||
onPressed: onNo,
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
if (!focusYes) ...[
|
||||
AlertDialogAction(
|
||||
text: no,
|
||||
primary: !focusYes,
|
||||
secondary: focusYes && otherSecondary,
|
||||
onPressed: onNo,
|
||||
),
|
||||
],
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
const Spacer(),
|
||||
AlertDialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
backgroundColor: Theme.of(context).cardColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
topRight: Radius.circular(10),
|
||||
Widget build(BuildContext context) => Column(
|
||||
children: [
|
||||
const Spacer(),
|
||||
AlertDialog(
|
||||
insetPadding: EdgeInsets.zero,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
backgroundColor: Theme.of(context).cardColor,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
topRight: Radius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
content: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Stack(
|
||||
children: [
|
||||
|
@ -322,10 +311,11 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
body.call(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: buttons.isNotEmpty ? 40 : 0,
|
||||
bottom: 20,
|
||||
left: 20,
|
||||
right: 20),
|
||||
top: buttons.isNotEmpty ? 40 : 0,
|
||||
bottom: 20,
|
||||
left: 20,
|
||||
right: 20,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: buttons.map(
|
||||
|
@ -377,9 +367,9 @@ class IconicaAlertDialog extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
],
|
||||
)),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/material.dart' as m;
|
|||
|
||||
class DialogService {
|
||||
static DialogService? _instance;
|
||||
static DialogService get instance => _instance ??= DialogService();
|
||||
static final DialogService instance = _instance ??= DialogService();
|
||||
|
||||
Future<T?> showDialog<T>({
|
||||
required m.BuildContext context,
|
||||
|
@ -17,16 +17,14 @@ class DialogService {
|
|||
bool useSafeArea = false,
|
||||
bool useRootNavigator = true,
|
||||
m.RouteSettings? routeSettings,
|
||||
}) {
|
||||
return m.showDialog(
|
||||
}) =>
|
||||
m.showDialog(
|
||||
context: context,
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: barrierColor,
|
||||
barrierLabel: barrierLabel,
|
||||
useSafeArea: useSafeArea,
|
||||
useRootNavigator: useRootNavigator,
|
||||
builder: (ctx) {
|
||||
return m.Builder(builder: builder);
|
||||
});
|
||||
}
|
||||
builder: (ctx) => m.Builder(builder: builder),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,16 +9,17 @@ class PopUp extends StatelessWidget {
|
|||
const PopUp({
|
||||
required this.popUpData,
|
||||
this.onTap,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
final void Function()? onTap;
|
||||
final PopUpData popUpData;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var style = Theme.of(context).textTheme.bodyText1?.copyWith(
|
||||
color: popUpData.textColor ?? Theme.of(context).backgroundColor,
|
||||
var style = Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color:
|
||||
popUpData.textColor ?? Theme.of(context).colorScheme.background,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
height: 1.571,
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'package:flutter_dialogs/src/popup_data.dart';
|
|||
import 'package:flutter_dialogs/src/popup_service.dart';
|
||||
|
||||
class PopUpParent extends StatefulWidget {
|
||||
const PopUpParent({required this.child, Key? key}) : super(key: key);
|
||||
const PopUpParent({required this.child, super.key});
|
||||
|
||||
final Widget child;
|
||||
|
||||
|
@ -26,7 +26,7 @@ class PopUpParentState extends State<PopUpParent> {
|
|||
final Queue<PopUpData> _popUpQueue = Queue();
|
||||
|
||||
void displayPopUp(PopUpData popUp) {
|
||||
if (_showPopUp == true) {
|
||||
if (_showPopUp) {
|
||||
_popUpQueue.add(popUp);
|
||||
return;
|
||||
}
|
||||
|
@ -62,33 +62,31 @@ class PopUpParentState extends State<PopUpParent> {
|
|||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
widget.child,
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height -
|
||||
MediaQuery.of(context).viewInsets.bottom,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: AnimatedCrossFade(
|
||||
firstChild: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
Widget build(BuildContext context) => Stack(
|
||||
children: [
|
||||
widget.child,
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height -
|
||||
MediaQuery.of(context).viewInsets.bottom,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: AnimatedCrossFade(
|
||||
firstChild: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
),
|
||||
secondChild: _popUp?.custom ??
|
||||
PopUp(
|
||||
popUpData: _popUp ?? PopUpData(const Duration(seconds: 3)),
|
||||
onTap: () {
|
||||
_closePopUp(_popUpId);
|
||||
},
|
||||
),
|
||||
crossFadeState: _showPopUp
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
),
|
||||
secondChild: _popUp?.custom ??
|
||||
PopUp(
|
||||
popUpData: _popUp ?? PopUpData(const Duration(seconds: 3)),
|
||||
onTap: () {
|
||||
_closePopUp(_popUpId);
|
||||
},
|
||||
),
|
||||
crossFadeState: _showPopUp
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:flutter_dialogs/src/popup_parent.dart';
|
|||
|
||||
class PopUpService {
|
||||
static PopUpService? _instance;
|
||||
static PopUpService get instance => _instance ??= PopUpService();
|
||||
static final PopUpService instance = _instance ??= PopUpService();
|
||||
|
||||
late PopUpParentState currentState;
|
||||
|
||||
|
@ -19,22 +19,26 @@ class PopUpService {
|
|||
Color? backgroundColor,
|
||||
Color? textColor,
|
||||
}) {
|
||||
currentState.displayPopUp(PopUpData(
|
||||
duration,
|
||||
text: text,
|
||||
icon: icon,
|
||||
backgroundColor: backgroundColor,
|
||||
textColor: textColor,
|
||||
));
|
||||
currentState.displayPopUp(
|
||||
PopUpData(
|
||||
duration,
|
||||
text: text,
|
||||
icon: icon,
|
||||
backgroundColor: backgroundColor,
|
||||
textColor: textColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showCustom(
|
||||
Widget custom, {
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
}) {
|
||||
currentState.displayPopUp(PopUpData(
|
||||
duration,
|
||||
custom: custom,
|
||||
));
|
||||
currentState.displayPopUp(
|
||||
PopUpData(
|
||||
duration,
|
||||
custom: custom,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: flutter_dialogs
|
||||
description: A new Flutter package project.
|
||||
version: 0.0.1
|
||||
version: 0.0.2
|
||||
homepage: https://github.com/Iconica-Development/flutter_dialogs
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
sdk: ">=2.18.2 <3.0.0"
|
||||
flutter: ">=1.17.0"
|
||||
|
||||
dependencies:
|
||||
|
@ -14,6 +14,9 @@ dependencies:
|
|||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
flutter_iconica_analysis:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_iconica_analysis
|
||||
ref: 6.0.0
|
||||
|
||||
flutter:
|
||||
|
|
Loading…
Reference in a new issue