Skip to content

Commit

Permalink
Add two fields to ClassicGeneralDialogWidget.
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhiliang committed Aug 8, 2019
1 parent 18963a1 commit efd0924
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "1.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
34 changes: 22 additions & 12 deletions lib/src/classic_dialog_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class ClassicGeneralDialogWidget extends StatelessWidget {
///Text of positive button, the right button at the bottom of dialog
final String positiveText;

///TextStyle of negative button, the left button at the bottom of dialog
final TextStyle negativeTextStyle;

///TextStyle of positive button, the right button at the bottom of dialog
final TextStyle positiveTextStyle;

///Click callback of negative button
final VoidCallback onNegativeClick;

Expand All @@ -44,6 +50,8 @@ class ClassicGeneralDialogWidget extends StatelessWidget {
this.actions,
this.negativeText,
this.positiveText,
this.negativeTextStyle,
this.positiveTextStyle,
this.onNegativeClick,
this.onPositiveClick,
});
Expand Down Expand Up @@ -71,12 +79,13 @@ class ClassicGeneralDialogWidget extends StatelessWidget {
onPressed: onNegativeClick,
splashColor: Theme.of(context).splashColor,
highlightColor: Theme.of(context).highlightColor,
child: new Text(
child: Text(
negativeText ?? 'cancel',
style: TextStyle(
color: Theme.of(context).textTheme.overline.color,
fontSize:
Theme.of(context).textTheme.button.fontSize),
style: negativeTextStyle ??
TextStyle(
color: Theme.of(context).textTheme.overline.color,
fontSize:
Theme.of(context).textTheme.button.fontSize),
),
)
: null,
Expand All @@ -85,12 +94,13 @@ class ClassicGeneralDialogWidget extends StatelessWidget {
onPressed: onPositiveClick,
splashColor: Theme.of(context).splashColor,
highlightColor: Theme.of(context).highlightColor,
child: new Text(
child: Text(
positiveText ?? 'confirm',
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize:
Theme.of(context).textTheme.button.fontSize),
style: positiveTextStyle ??
TextStyle(
color: Theme.of(context).primaryColor,
fontSize:
Theme.of(context).textTheme.button.fontSize),
),
)
: null,
Expand Down Expand Up @@ -295,7 +305,7 @@ class ClassicListDialogWidgetState<T> extends State<ClassicListDialogWidget> {
onPressed: widget.onNegativeClick,
splashColor: Theme.of(context).splashColor,
highlightColor: Theme.of(context).highlightColor,
child: new Text(
child: Text(
widget.negativeText ?? 'cancel',
style: TextStyle(
color: Theme.of(context).textTheme.overline.color,
Expand Down Expand Up @@ -328,7 +338,7 @@ class ClassicListDialogWidgetState<T> extends State<ClassicListDialogWidget> {
},
splashColor: Theme.of(context).splashColor,
highlightColor: Theme.of(context).highlightColor,
child: new Text(
child: Text(
widget.positiveText ?? 'confirm',
style: TextStyle(
color: Theme.of(context).primaryColor,
Expand Down

0 comments on commit efd0924

Please sign in to comment.