Skip to content

Commit

Permalink
feat: Horizontal buttons for Dialogs (openfoodfacts#2626)
Browse files Browse the repository at this point in the history
* Revert "Revert "feat: Smooth Dialog with an axis for buttons (openfoodfacts#2587)" (openfoodfacts#2608)"

This reverts commit 6b52473.

* Many fixes

* Small doc + Title & Cross in separated widgets

* Increase a little bit the line height to improve readability

Co-authored-by: monsieurtanuki <fabrice_fontaine@hotmail.com>
  • Loading branch information
g123k and monsieurtanuki authored Aug 18, 2022
1 parent e798376 commit ddb8bea
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 115 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
class ContributorsModel {
ContributorsModel({required this.avatarUrl, required this.profilePath});
ContributorsModel({
required this.avatarUrl,
required this.profilePath,
required this.login,
});

ContributorsModel.fromJson(Map<String, dynamic> json)
: profilePath = json['html_url'].toString(),
login = json['login'].toString(),
avatarUrl = json['avatar_url'].toString();

final String avatarUrl;
final String profilePath;
final String login;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,27 @@ class SmoothSimpleButton extends StatelessWidget {
final Color? buttonColor;

@override
Widget build(BuildContext context) => Container(
constraints: BoxConstraints(minWidth: minWidth, minHeight: height),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: buttonColor == null
? null
: MaterialStateProperty.all<Color>(buttonColor!),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(borderRadius: borderRadius),
),
),
onPressed: onPressed,
child: Padding(
padding: padding,
child: child,
Widget build(BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints(
minWidth: minWidth,
minHeight: height,
),
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: buttonColor == null
? null
: MaterialStateProperty.all<Color>(buttonColor!),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(borderRadius: borderRadius),
),
),
);
onPressed: onPressed,
child: Padding(
padding: padding,
child: child,
),
),
);
}
}
Loading

0 comments on commit ddb8bea

Please sign in to comment.