mirror of
https://github.com/Iconica-Development/flutter_dialogs.git
synced 2025-05-18 19:03:43 +02:00
chore: apply newest iconica linter version
This commit is contained in:
parent
586174c264
commit
be6784a3db
15 changed files with 497 additions and 643 deletions
|
@ -1,29 +1,9 @@
|
||||||
# This file configures the analyzer, which statically analyzes Dart code to
|
include: package:flutter_iconica_analysis/analysis_options.yaml
|
||||||
# check for errors, warnings, and lints.
|
|
||||||
#
|
|
||||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
|
||||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
|
||||||
# invoked from the command line by running `flutter analyze`.
|
|
||||||
|
|
||||||
# The following line activates a set of recommended lints for Flutter apps,
|
# Possible to overwrite the rules from the package
|
||||||
# packages, and plugins designed to encourage good coding practices.
|
|
||||||
include: package:flutter_lints/flutter.yaml
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
|
||||||
# included above or to enable additional rules. A list of all available lints
|
|
||||||
# and their documentation is published at
|
|
||||||
# https://dart-lang.github.io/linter/lints/index.html.
|
|
||||||
#
|
|
||||||
# Instead of disabling a lint rule for the entire project in the
|
|
||||||
# section below, it can also be suppressed for a single line of code
|
|
||||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
|
||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
|
||||||
# producing the lint.
|
|
||||||
rules:
|
rules:
|
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
|
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
|
||||||
|
|
||||||
# Additional information about this file can be found at
|
|
||||||
# https://dart.dev/guides/language/analysis-options
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_dialogs/flutter_dialogs.dart';
|
import "package:flutter_dialogs/flutter_dialogs.dart";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const DialogDemoApp());
|
runApp(const DialogDemoApp());
|
||||||
|
@ -13,24 +13,20 @@ class DialogDemoApp extends StatelessWidget {
|
||||||
const DialogDemoApp({super.key});
|
const DialogDemoApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => MaterialApp(
|
||||||
return MaterialApp(
|
title: "Flutter Dialogs demo",
|
||||||
title: 'Flutter Dialogs demo',
|
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
home: const DialogDemoPage(title: 'Flutter Dialogs demo'),
|
home: const DialogDemoPage(title: "Flutter Dialogs demo"),
|
||||||
builder: (context, child) {
|
builder: (context, child) => BottomAlertDialogConfig(
|
||||||
return BottomAlertDialogConfig(
|
|
||||||
child: child ?? const SizedBox.shrink(),
|
child: child ?? const SizedBox.shrink(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DialogDemoPage extends StatefulWidget {
|
class DialogDemoPage extends StatefulWidget {
|
||||||
const DialogDemoPage({super.key, required this.title});
|
const DialogDemoPage({required this.title, super.key});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
@ -45,8 +41,7 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => PopUpParent(
|
||||||
return PopUpParent(
|
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
|
@ -60,19 +55,18 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
PopUpService.instance.showIconText('test');
|
PopUpService.instance.showIconText("test");
|
||||||
},
|
},
|
||||||
child: const Text('Show popup'),
|
child: const Text("Show popup"),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => DialogService.instance.showDialog(
|
||||||
DialogService.instance.showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => IconicaAlertDialog.multiButton(
|
builder: (_) => IconicaAlertDialog.multiButton(
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
title: 'title',
|
title: "title",
|
||||||
body: 'body',
|
body: "body",
|
||||||
iconButton: (context, onPressed) => IconButton(
|
iconButton: (context, onPressed) => IconButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
icon: const Icon(Icons.dangerous),
|
icon: const Icon(Icons.dangerous),
|
||||||
|
@ -80,7 +74,7 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
primaryButton: (onPressed, child, context) =>
|
primaryButton: (onPressed, child, context) =>
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
debugPrint('custom button');
|
debugPrint("custom button");
|
||||||
onPressed.call();
|
onPressed.call();
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
|
@ -88,138 +82,123 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
buttons: [
|
buttons: [
|
||||||
AlertDialogAction(
|
AlertDialogAction(
|
||||||
primary: true,
|
primary: true,
|
||||||
text: 'test',
|
text: "test",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
debugPrint('test');
|
debugPrint("test");
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
AlertDialogAction(
|
AlertDialogAction(
|
||||||
secondary: true,
|
secondary: true,
|
||||||
text: 'test',
|
text: "test",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
debugPrint('test');
|
debugPrint("test");
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
child: const Text("Show dialog"),
|
||||||
child: const Text('Show dialog'),
|
|
||||||
),
|
),
|
||||||
const Spacer(
|
const Spacer(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.singleButton(
|
||||||
return BottomAlertDialog.singleButton(
|
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
title: const Text('Confirm'),
|
title: const Text("Confirm"),
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Click the button to dismiss',
|
"Click the button to dismiss",
|
||||||
),
|
),
|
||||||
buttonText: 'Ok',
|
buttonText: "Ok",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.singleButton"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.singleButton'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.multiButton(
|
||||||
return BottomAlertDialog.multiButton(
|
title: const Text("Favorite Color"),
|
||||||
title: const Text('Favorite Color'),
|
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Choose your favorite color',
|
"Choose your favorite color",
|
||||||
),
|
),
|
||||||
buttons: [
|
buttons: [
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Red',
|
text: "Red",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
),
|
),
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Green',
|
text: "Green",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
),
|
),
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Blue',
|
text: "Blue",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
),
|
),
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Yellow',
|
text: "Yellow",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.multiButton"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.multiButton'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.singleButtonIcon(
|
||||||
return BottomAlertDialog.singleButtonIcon(
|
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
title: const Text('Confirm'),
|
title: const Text("Confirm"),
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Click the button to dismiss',
|
"Click the button to dismiss",
|
||||||
),
|
),
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.info,
|
Icons.info,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
buttonText: 'Ok',
|
buttonText: "Ok",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.singleButtonIcon"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.singleButtonIcon'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.icon(
|
||||||
return BottomAlertDialog.icon(
|
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
title: const Text('Favorite Car'),
|
title: const Text("Favorite Car"),
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Choose your favorite car brand',
|
"Choose your favorite car brand",
|
||||||
),
|
),
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.car_rental_sharp,
|
Icons.car_rental_sharp,
|
||||||
|
@ -229,51 +208,47 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('BMW'),
|
child: const Text("BMW"),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('Opel'),
|
child: const Text("Opel"),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('Mercedes'),
|
child: const Text("Mercedes"),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('Kia'),
|
child: const Text("Kia"),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('Skoda'),
|
child: const Text("Skoda"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.icon"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.icon'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.yesOrNo(
|
||||||
return BottomAlertDialog.yesOrNo(
|
title: const Text("Question"),
|
||||||
title: const Text('Question'),
|
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Do you really wanna do this?',
|
"Do you really wanna do this?",
|
||||||
),
|
),
|
||||||
onYes: () {
|
onYes: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -281,24 +256,20 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
onNo: () {
|
onNo: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.yesOrNo"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.yesOrNo'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.yesOrNoIcon(
|
||||||
return BottomAlertDialog.yesOrNoIcon(
|
title: const Text("Question"),
|
||||||
title: const Text('Question'),
|
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Do you really wanna do this?',
|
"Do you really wanna do this?",
|
||||||
),
|
),
|
||||||
onYes: () {
|
onYes: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -310,42 +281,29 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
Icons.question_mark_sharp,
|
Icons.question_mark_sharp,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.yesOrNoIcon"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.yesOrNoIcon'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.custom(
|
||||||
return BottomAlertDialog.custom(
|
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
body: SizedBox(
|
body: SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('Custom Dialog with PageView'),
|
const Text("Custom Dialog with PageView"),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: PageView(
|
child: PageView(
|
||||||
children: [
|
children: const [
|
||||||
Container(
|
Center(child: Text("Page 1")),
|
||||||
child:
|
Center(child: Text("Page 2")),
|
||||||
const Center(child: Text('Page 1')),
|
Center(child: Text("Page 3")),
|
||||||
),
|
|
||||||
Container(
|
|
||||||
child:
|
|
||||||
const Center(child: Text('Page 2')),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
child:
|
|
||||||
const Center(child: Text('Page 3')),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -357,86 +315,82 @@ class _DialogDemoPageState extends State<DialogDemoPage> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: const Text('Ok'),
|
child: const Text("Ok"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
child: const Text("BottomAlertDialog.custom"),
|
||||||
},
|
|
||||||
child: const Text('BottomAlertDialog.custom'),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('Multiple chained dialogs'),
|
child: const Text("Multiple chained dialogs"),
|
||||||
onPressed: () {
|
onPressed: () async => showDialog(
|
||||||
showDialog(
|
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) => BottomAlertDialog.yesOrNo(
|
||||||
return BottomAlertDialog.yesOrNo(
|
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
title: const Text('Pokémon'),
|
title: const Text("Pokémon"),
|
||||||
body: const Text(
|
body: const Text(
|
||||||
'Do you want to choose your starter Pokémon?',
|
"Do you want to choose your starter Pokémon?",
|
||||||
),
|
),
|
||||||
onYes: () {
|
onYes: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => BottomAlertDialog.multiButton(
|
builder: (context) => BottomAlertDialog.multiButton(
|
||||||
title: const Text('Starter Pokémon'),
|
title: const Text("Starter Pokémon"),
|
||||||
body: const Text('Choose a starter Pokémon'),
|
body: const Text("Choose a starter Pokémon"),
|
||||||
buttons: [
|
buttons: [
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Turtwig',
|
text: "Turtwig",
|
||||||
buttonType: ButtonType.secondary,
|
buttonType: ButtonType.secondary,
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
_showDoneDialog(context, 'Turtwig'),
|
_showDoneDialog(context, "Turtwig"),
|
||||||
),
|
),
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Chimchar',
|
text: "Chimchar",
|
||||||
buttonType: ButtonType.secondary,
|
buttonType: ButtonType.secondary,
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
_showDoneDialog(context, 'Chimchar'),
|
_showDoneDialog(context, "Chimchar"),
|
||||||
),
|
),
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'Piplup',
|
text: "Piplup",
|
||||||
buttonType: ButtonType.secondary,
|
buttonType: ButtonType.secondary,
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
_showDoneDialog(context, 'Piplup'),
|
_showDoneDialog(context, "Piplup"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onNo: () => Navigator.pop(context),
|
onNo: () => Navigator.pop(context),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
);
|
),
|
||||||
},
|
const Spacer(
|
||||||
|
flex: 3,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
void _showDoneDialog(BuildContext context, String name) {
|
Future<void> _showDoneDialog(BuildContext context, String name) async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => BottomAlertDialog.icon(
|
builder: (context) => BottomAlertDialog.icon(
|
||||||
title: const Text('Good choice!'),
|
title: const Text("Good choice!"),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.catching_pokemon,
|
Icons.catching_pokemon,
|
||||||
color: Color(name.hashCode).withAlpha(255),
|
color: Color(name.hashCode).withAlpha(255),
|
||||||
),
|
),
|
||||||
body: Text('You chose $name to be your starter Pokémon.'),
|
body: Text("You chose $name to be your starter Pokémon."),
|
||||||
buttons: [
|
buttons: const [
|
||||||
const CloseButton(
|
CloseButton(
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,93 +1,25 @@
|
||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
|
|
||||||
# The following line prevents the package from being accidentally published to
|
|
||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
# The following defines the version and build number for your application.
|
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
|
||||||
# followed by an optional build number separated by a +.
|
|
||||||
# Both the version and the builder number may be overridden in flutter
|
|
||||||
# build by specifying --build-name and --build-number, respectively.
|
|
||||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
|
||||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
|
||||||
# Read more about iOS versioning at
|
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.2 <3.0.0'
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
|
||||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
|
||||||
# dependencies can be manually updated by changing the version numbers below to
|
|
||||||
# the latest version available on pub.dev. To see which dependencies have newer
|
|
||||||
# versions available, run `flutter pub outdated`.
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
|
||||||
cupertino_icons: ^1.0.2
|
|
||||||
flutter_dialogs:
|
flutter_dialogs:
|
||||||
path: ../
|
path: ../
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_iconica_analysis:
|
||||||
|
git:
|
||||||
|
url: https://github.com/Iconica-Development/flutter_iconica_analysis
|
||||||
|
ref: 7.0.0
|
||||||
|
|
||||||
# The "flutter_lints" package below contains a set of recommended lints to
|
|
||||||
# encourage good coding practices. The lint set provided by the package is
|
|
||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
|
||||||
# package. See that file for information about deactivating specific lint
|
|
||||||
# rules and activating additional ones.
|
|
||||||
flutter_lints: ^2.0.0
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
|
||||||
|
|
||||||
# The following section is specific to Flutter packages.
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
# The following line ensures that the Material Icons font is
|
|
||||||
# included with your application, so that you can use the icons in
|
|
||||||
# the material Icons class.
|
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
|
||||||
# assets:
|
|
||||||
# - images/a_dot_burr.jpeg
|
|
||||||
# - images/a_dot_ham.jpeg
|
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
|
||||||
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
|
||||||
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
|
||||||
# - family: Schyler
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
|
||||||
# style: italic
|
|
||||||
# - family: Trajan Pro
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/TrajanPro.ttf
|
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
|
||||||
# weight: 700
|
|
||||||
#
|
|
||||||
# For details regarding fonts from package dependencies,
|
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
|
||||||
|
|
|
@ -9,26 +9,25 @@
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
// tree, read text, and verify that the values of widget properties are correct.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:example/main.dart";
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import "package:flutter/material.dart";
|
||||||
|
import "package:flutter_test/flutter_test.dart";
|
||||||
import 'package:example/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
testWidgets("Counter increments smoke test", (WidgetTester tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(const DialogDemoApp());
|
await tester.pumpWidget(const DialogDemoApp());
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(find.text("0"), findsOneWidget);
|
||||||
expect(find.text('1'), findsNothing);
|
expect(find.text("1"), findsNothing);
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
// Tap the '+' icon and trigger a frame.
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
await tester.tap(find.byIcon(Icons.add));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
// Verify that our counter has incremented.
|
||||||
expect(find.text('0'), findsNothing);
|
expect(find.text("0"), findsNothing);
|
||||||
expect(find.text('1'), findsOneWidget);
|
expect(find.text("1"), findsOneWidget);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
///
|
///
|
||||||
library flutter_dialogs;
|
library flutter_dialogs;
|
||||||
|
|
||||||
export './src/alert_dialogs.dart';
|
export "./src/alert_dialogs.dart";
|
||||||
export './src/dialogs.dart';
|
export "./src/bottom_alert_dialog.dart";
|
||||||
export './src/popup_parent.dart';
|
export "./src/bottom_alert_dialog_config.dart";
|
||||||
export './src/popup_service.dart';
|
export "./src/dialogs.dart";
|
||||||
export './src/bottom_alert_dialog_config.dart';
|
export "./src/popup_parent.dart";
|
||||||
export './src/bottom_alert_dialog.dart';
|
export "./src/popup_service.dart";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
class AlertDialogAction {
|
class AlertDialogAction {
|
||||||
AlertDialogAction({
|
AlertDialogAction({
|
||||||
|
@ -256,8 +256,8 @@ class IconicaAlertDialog extends StatelessWidget {
|
||||||
bool otherSecondary,
|
bool otherSecondary,
|
||||||
VoidCallback onYes,
|
VoidCallback onYes,
|
||||||
VoidCallback onNo, {
|
VoidCallback onNo, {
|
||||||
String no = 'No',
|
String no = "No",
|
||||||
String yes = 'Yes',
|
String yes = "Yes",
|
||||||
}) =>
|
}) =>
|
||||||
<AlertDialogAction>[
|
<AlertDialogAction>[
|
||||||
if (focusYes) ...[
|
if (focusYes) ...[
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_dialogs/src/bottom_alert_dialog_config.dart';
|
import "package:flutter_dialogs/src/bottom_alert_dialog_config.dart";
|
||||||
|
|
||||||
class BottomAlertDialogAction extends StatelessWidget {
|
class BottomAlertDialogAction extends StatelessWidget {
|
||||||
const BottomAlertDialogAction({
|
const BottomAlertDialogAction({
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.buttonType = ButtonType.tertiary,
|
this.buttonType = ButtonType.tertiary,
|
||||||
Key? key,
|
super.key,
|
||||||
}) : super(key: key);
|
});
|
||||||
final String text;
|
final String text;
|
||||||
final ButtonType buttonType;
|
final ButtonType buttonType;
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
@ -21,9 +21,9 @@ class BottomAlertDialogAction extends StatelessWidget {
|
||||||
var config = BottomAlertDialogConfig.of(context);
|
var config = BottomAlertDialogConfig.of(context);
|
||||||
var buttonBuilder = config.buttonBuilder;
|
var buttonBuilder = config.buttonBuilder;
|
||||||
var translatedText = text;
|
var translatedText = text;
|
||||||
if (text == 'shell.alertdialog.button.yes') {
|
if (text == "shell.alertdialog.button.yes") {
|
||||||
translatedText = config.yesText;
|
translatedText = config.yesText;
|
||||||
} else if (text == 'shell.alertdialog.button.no') {
|
} else if (text == "shell.alertdialog.button.no") {
|
||||||
translatedText = config.noText;
|
translatedText = config.noText;
|
||||||
}
|
}
|
||||||
return buttonBuilder.call(
|
return buttonBuilder.call(
|
||||||
|
@ -41,14 +41,13 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
required List<Widget> buttons,
|
required List<Widget> buttons,
|
||||||
List<BottomAlertDialogAction>? actions,
|
List<BottomAlertDialogAction>? actions,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog._(
|
BottomAlertDialog._(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
body: (_) => body,
|
body: (_) => body,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
factory BottomAlertDialog.singleButtonIcon({
|
factory BottomAlertDialog.singleButtonIcon({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
|
@ -58,8 +57,8 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
required VoidCallback onPressed,
|
required VoidCallback onPressed,
|
||||||
ButtonType buttonType = ButtonType.tertiary,
|
ButtonType buttonType = ButtonType.tertiary,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog.icon(
|
BottomAlertDialog.icon(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
title: title,
|
title: title,
|
||||||
icon: icon,
|
icon: icon,
|
||||||
|
@ -72,7 +71,6 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
factory BottomAlertDialog.yesOrNoIcon({
|
factory BottomAlertDialog.yesOrNoIcon({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
|
@ -83,15 +81,14 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
bool focusYes = true,
|
bool focusYes = true,
|
||||||
bool otherSecondary = false,
|
bool otherSecondary = false,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog.icon(
|
BottomAlertDialog.icon(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
title: title,
|
title: title,
|
||||||
body: body,
|
body: body,
|
||||||
icon: icon,
|
icon: icon,
|
||||||
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
buttons: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
factory BottomAlertDialog.yesOrNo({
|
factory BottomAlertDialog.yesOrNo({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
|
@ -101,15 +98,14 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
bool focusYes = true,
|
bool focusYes = true,
|
||||||
bool otherSecondary = false,
|
bool otherSecondary = false,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog.multiButton(
|
BottomAlertDialog.multiButton(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
title: title,
|
title: title,
|
||||||
body: body,
|
body: body,
|
||||||
buttons: const [],
|
buttons: const [],
|
||||||
actions: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
actions: _getYesNoDialogButtons(focusYes, otherSecondary, onYes, onNo),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
factory BottomAlertDialog.icon({
|
factory BottomAlertDialog.icon({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
|
@ -118,8 +114,8 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
required List<Widget> buttons,
|
required List<Widget> buttons,
|
||||||
List<BottomAlertDialogAction>? actions,
|
List<BottomAlertDialogAction>? actions,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog._(
|
BottomAlertDialog._(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
@ -137,7 +133,6 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
factory BottomAlertDialog.multiButton({
|
factory BottomAlertDialog.multiButton({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
|
@ -145,8 +140,8 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
required List<BottomAlertDialogAction> buttons,
|
required List<BottomAlertDialogAction> buttons,
|
||||||
List<BottomAlertDialogAction>? actions,
|
List<BottomAlertDialogAction>? actions,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog._(
|
BottomAlertDialog._(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
|
@ -165,7 +160,6 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
factory BottomAlertDialog.singleButton({
|
factory BottomAlertDialog.singleButton({
|
||||||
required Widget title,
|
required Widget title,
|
||||||
required Widget body,
|
required Widget body,
|
||||||
|
@ -173,8 +167,8 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
required VoidCallback onPressed,
|
required VoidCallback onPressed,
|
||||||
ButtonType buttonType = ButtonType.tertiary,
|
ButtonType buttonType = ButtonType.tertiary,
|
||||||
bool? closeButton,
|
bool? closeButton,
|
||||||
}) {
|
}) =>
|
||||||
return BottomAlertDialog.multiButton(
|
BottomAlertDialog.multiButton(
|
||||||
closeButton: closeButton,
|
closeButton: closeButton,
|
||||||
title: title,
|
title: title,
|
||||||
body: body,
|
body: body,
|
||||||
|
@ -186,7 +180,6 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
|
||||||
const BottomAlertDialog._({
|
const BottomAlertDialog._({
|
||||||
required this.buttons,
|
required this.buttons,
|
||||||
required this.body,
|
required this.body,
|
||||||
|
@ -203,18 +196,18 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
bool otherSecondary,
|
bool otherSecondary,
|
||||||
VoidCallback onYes,
|
VoidCallback onYes,
|
||||||
VoidCallback onNo,
|
VoidCallback onNo,
|
||||||
) {
|
) =>
|
||||||
return <BottomAlertDialogAction>[
|
<BottomAlertDialogAction>[
|
||||||
if (focusYes) ...[
|
if (focusYes) ...[
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'shell.alertdialog.button.no',
|
text: "shell.alertdialog.button.no",
|
||||||
buttonType:
|
buttonType:
|
||||||
otherSecondary ? ButtonType.secondary : ButtonType.tertiary,
|
otherSecondary ? ButtonType.secondary : ButtonType.tertiary,
|
||||||
onPressed: onNo,
|
onPressed: onNo,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'shell.alertdialog.button.yes',
|
text: "shell.alertdialog.button.yes",
|
||||||
buttonType: focusYes
|
buttonType: focusYes
|
||||||
? ButtonType.primary
|
? ButtonType.primary
|
||||||
: otherSecondary
|
: otherSecondary
|
||||||
|
@ -224,13 +217,12 @@ class BottomAlertDialog extends StatelessWidget {
|
||||||
),
|
),
|
||||||
if (!focusYes) ...[
|
if (!focusYes) ...[
|
||||||
BottomAlertDialogAction(
|
BottomAlertDialogAction(
|
||||||
text: 'shell.alertdialog.button.no',
|
text: "shell.alertdialog.button.no",
|
||||||
buttonType: ButtonType.primary,
|
buttonType: ButtonType.primary,
|
||||||
onPressed: onNo,
|
onPressed: onNo,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
enum ButtonType {
|
enum ButtonType {
|
||||||
primary,
|
primary,
|
||||||
|
@ -27,8 +27,8 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
required super.child,
|
required super.child,
|
||||||
ButtonBuilder? buttonBuilder,
|
ButtonBuilder? buttonBuilder,
|
||||||
CloseButtonBuilder? closeButtonBuilder,
|
CloseButtonBuilder? closeButtonBuilder,
|
||||||
this.yesText = 'Yes',
|
this.yesText = "Yes",
|
||||||
this.noText = 'No',
|
this.noText = "No",
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
super.key,
|
super.key,
|
||||||
}) : _buttonBuilder = buttonBuilder,
|
}) : _buttonBuilder = buttonBuilder,
|
||||||
|
@ -54,9 +54,9 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
MaterialStateProperty.all(theme.colorScheme.primary),
|
WidgetStateProperty.all(theme.colorScheme.primary),
|
||||||
foregroundColor: MaterialStateProperty.all(Colors.black),
|
foregroundColor: WidgetStateProperty.all(Colors.black),
|
||||||
shape: MaterialStateProperty.all(
|
shape: WidgetStateProperty.all(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
side: BorderSide(color: theme.colorScheme.primary),
|
side: BorderSide(color: theme.colorScheme.primary),
|
||||||
|
@ -69,9 +69,9 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
case ButtonType.secondary:
|
case ButtonType.secondary:
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateProperty.all(Colors.white),
|
backgroundColor: WidgetStateProperty.all(Colors.white),
|
||||||
foregroundColor: MaterialStateProperty.all(Colors.black),
|
foregroundColor: WidgetStateProperty.all(Colors.black),
|
||||||
shape: MaterialStateProperty.all(
|
shape: WidgetStateProperty.all(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
side: BorderSide(color: theme.colorScheme.primary),
|
side: BorderSide(color: theme.colorScheme.primary),
|
||||||
|
@ -84,10 +84,10 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
case ButtonType.tertiary:
|
case ButtonType.tertiary:
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
shadowColor: MaterialStateProperty.all(Colors.transparent),
|
shadowColor: WidgetStateProperty.all(Colors.transparent),
|
||||||
backgroundColor: MaterialStateProperty.all(Colors.white),
|
backgroundColor: WidgetStateProperty.all(Colors.white),
|
||||||
foregroundColor: MaterialStateProperty.all(Colors.black),
|
foregroundColor: WidgetStateProperty.all(Colors.black),
|
||||||
shape: MaterialStateProperty.all(
|
shape: WidgetStateProperty.all(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
side: const BorderSide(color: Colors.white),
|
side: const BorderSide(color: Colors.white),
|
||||||
|
@ -102,8 +102,7 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
|
|
||||||
CloseButtonBuilder get closeButtonBuilder =>
|
CloseButtonBuilder get closeButtonBuilder =>
|
||||||
_closeButtonBuilder ??
|
_closeButtonBuilder ??
|
||||||
(context, {required onPressed}) {
|
(context, {required onPressed}) => IconButton(
|
||||||
return IconButton(
|
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
|
@ -111,12 +110,11 @@ class BottomAlertDialogConfig extends InheritedWidget {
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
static BottomAlertDialogConfig of(BuildContext context) {
|
static BottomAlertDialogConfig of(BuildContext context) {
|
||||||
var result =
|
var result =
|
||||||
context.dependOnInheritedWidgetOfExactType<BottomAlertDialogConfig>();
|
context.dependOnInheritedWidgetOfExactType<BottomAlertDialogConfig>();
|
||||||
assert(result != null, 'No BottomAlertDialogConfig found in context');
|
assert(result != null, "No BottomAlertDialogConfig found in context");
|
||||||
return result!;
|
return result!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart' as m;
|
import "package:flutter/material.dart" as m;
|
||||||
|
|
||||||
class DialogService {
|
class DialogService {
|
||||||
static DialogService? _instance;
|
static DialogService? _instance;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_dialogs/src/popup_data.dart';
|
import "package:flutter_dialogs/src/popup_data.dart";
|
||||||
|
|
||||||
class PopUp extends StatelessWidget {
|
class PopUp extends StatelessWidget {
|
||||||
const PopUp({
|
const PopUp({
|
||||||
|
@ -18,8 +18,7 @@ class PopUp extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var style = Theme.of(context).textTheme.bodyLarge?.copyWith(
|
var style = Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||||
color:
|
color: popUpData.textColor ?? Theme.of(context).colorScheme.surface,
|
||||||
popUpData.textColor ?? Theme.of(context).colorScheme.background,
|
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
height: 1.571,
|
height: 1.571,
|
||||||
|
@ -48,7 +47,7 @@ class PopUp extends StatelessWidget {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 20, bottom: 5),
|
padding: const EdgeInsets.only(left: 20, bottom: 5),
|
||||||
child: Text(
|
child: Text(
|
||||||
popUpData.text ?? '',
|
popUpData.text ?? "",
|
||||||
style: style,
|
style: style,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
class PopUpData {
|
class PopUpData {
|
||||||
PopUpData(
|
PopUpData(
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'dart:collection';
|
import "dart:collection";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_dialogs/src/popup.dart';
|
import "package:flutter_dialogs/src/popup.dart";
|
||||||
import 'package:flutter_dialogs/src/popup_data.dart';
|
import "package:flutter_dialogs/src/popup_data.dart";
|
||||||
import 'package:flutter_dialogs/src/popup_service.dart';
|
import "package:flutter_dialogs/src/popup_service.dart";
|
||||||
|
|
||||||
class PopUpParent extends StatefulWidget {
|
class PopUpParent extends StatefulWidget {
|
||||||
const PopUpParent({required this.child, super.key});
|
const PopUpParent({required this.child, super.key});
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_dialogs/src/popup_data.dart';
|
import "package:flutter_dialogs/src/popup_data.dart";
|
||||||
import 'package:flutter_dialogs/src/popup_parent.dart';
|
import "package:flutter_dialogs/src/popup_parent.dart";
|
||||||
|
|
||||||
class PopUpService {
|
class PopUpService {
|
||||||
static PopUpService? _instance;
|
static PopUpService? _instance;
|
||||||
|
|
|
@ -17,6 +17,6 @@ dev_dependencies:
|
||||||
flutter_iconica_analysis:
|
flutter_iconica_analysis:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_iconica_analysis
|
url: https://github.com/Iconica-Development/flutter_iconica_analysis
|
||||||
ref: 6.0.0
|
ref: 7.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import "package:flutter_test/flutter_test.dart";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('', () {
|
test("", () {
|
||||||
expect(true, true);
|
expect(true, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue