-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Changing_grpc' into change_app_name
# Conflicts: # lib/presentation/atoms/atoms.dart # lib/presentation/pages/splash_page.dart # pubspec.yaml
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:cybear_jinni/presentation/atoms/atoms.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ButtonWidgetAtom extends StatelessWidget { | ||
const ButtonWidgetAtom({ | ||
required this.variant, | ||
required this.onPressed, | ||
super.key, | ||
this.text, | ||
this.icon, | ||
this.disabled = false, | ||
this.disableActionType = false, | ||
this.translate = true, | ||
}); | ||
|
||
final ButtonVariant variant; | ||
final VoidCallback onPressed; | ||
final String? text; | ||
final IconData? icon; | ||
double get width => 250; | ||
double get _height => 60; | ||
final bool disabled; | ||
final bool translate; | ||
final bool disableActionType; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final ThemeData themeData = Theme.of(context); | ||
final TextTheme textTheme = themeData.textTheme; | ||
final ColorScheme colorScheme = themeData.colorScheme; | ||
|
||
if (variant == ButtonVariant.primary) { | ||
return Container( | ||
constraints: const BoxConstraints( | ||
minWidth: 300, | ||
), | ||
height: _height, | ||
child: FilledButton.icon( | ||
onPressed: onPressed, | ||
style: FilledButton.styleFrom().copyWith( | ||
alignment: Alignment.center, | ||
backgroundColor: disabled | ||
? MaterialStateProperty.all(colorScheme.surfaceVariant) | ||
: null, | ||
), | ||
icon: Icon(icon), | ||
label: TextAtom( | ||
text ?? '', | ||
translate: translate, | ||
maxLines: 1, | ||
style: textTheme.bodyLarge!.copyWith( | ||
color: colorScheme.onPrimary, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
return const Text('Type is not supported yet'); | ||
} | ||
} | ||
|
||
enum ButtonVariant { | ||
primary, | ||
secondary, | ||
tertiary, | ||
action, | ||
actionToggled, | ||
back, | ||
} |
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