-
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:Smooth buttons a bit (#998)
* refactor:Smooth buttons * Format: * Format: * Format: * Format: * Format: Co-authored-by: Jasmeet Singh <jasmeetsingh@google.com>
- Loading branch information
1 parent
738fdf9
commit 4c5c29c
Showing
5 changed files
with
71 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/smooth_ui_library/lib/buttons/smooth_large_button_with_icon.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:smooth_ui_library/buttons/smooth_simple_button.dart'; | ||
import 'package:smooth_ui_library/util/ui_helpers.dart'; | ||
|
||
class SmoothLargeButtonWithIcon extends StatelessWidget { | ||
const SmoothLargeButtonWithIcon({ | ||
required this.text, | ||
required this.icon, | ||
required this.onPressed, | ||
required this.isDarkMode, | ||
this.padding, | ||
}); | ||
|
||
final String text; | ||
final IconData icon; | ||
final VoidCallback onPressed; | ||
final bool isDarkMode; | ||
final EdgeInsets? padding; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final ThemeData themeData = Theme.of(context); | ||
return SmoothSimpleButton( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: <Widget>[ | ||
Icon( | ||
icon, | ||
color: isDarkMode | ||
? Theme.of(context).colorScheme.onPrimary | ||
: Colors.blue, | ||
), | ||
const Spacer(), | ||
Text( | ||
text, | ||
textAlign: TextAlign.center, | ||
style: themeData.textTheme.bodyText2!.copyWith( | ||
color: isDarkMode | ||
? Theme.of(context).colorScheme.onPrimary | ||
: Colors.blue, | ||
), | ||
), | ||
const Spacer(), | ||
], | ||
), | ||
minWidth: double.infinity, | ||
borderRadius: const BorderRadius.all(Radius.circular(SMALL_SPACE)), | ||
padding: padding ?? const EdgeInsets.all(10), | ||
buttonColor: isDarkMode ? Colors.grey : const Color(0xffeaf5fb), | ||
onPressed: onPressed, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters