diff --git a/packages/component_library/example/lib/stories.dart b/packages/component_library/example/lib/stories.dart index 8116ac8..d2935f8 100644 --- a/packages/component_library/example/lib/stories.dart +++ b/packages/component_library/example/lib/stories.dart @@ -62,59 +62,5 @@ List getStories(GolekThemeData theme) { inputLabel: '', ), ), - Story.simple( - name: 'Simple Expanded Elevated Button', - section: 'Buttons', - child: ExpandedElevatedButton( - label: 'Press me', - onTap: () {}, - ), - ), - Story( - name: 'Expanded Elevated Button', - section: 'Buttons', - builder: (_, k) => ExpandedElevatedButton( - label: k.text( - label: 'label', - initial: 'Press me', - ), - onTap: k.boolean( - label: 'onTap', - initial: true, - ) - ? () {} - : null, - icon: Icon( - k.options( - label: 'icon', - initial: Icons.home, - options: const [ - Option( - 'Login', - Icons.login, - ), - Option( - 'Refresh', - Icons.refresh, - ), - Option( - 'Logout', - Icons.logout, - ), - ], - ), - ), - ), - ), - Story( - name: 'InProgress Expanded Elevated Button', - section: 'Buttons', - builder: (_, k) => ExpandedElevatedButton.inProgress( - label: k.text( - label: 'label', - initial: 'Processing', - ), - ), - ), ]; } diff --git a/packages/component_library/lib/component_library.dart b/packages/component_library/lib/component_library.dart index dd77b46..2a6d63c 100644 --- a/packages/component_library/lib/component_library.dart +++ b/packages/component_library/lib/component_library.dart @@ -1,4 +1,3 @@ -export 'src/expanded_elevated_button.dart'; export 'src/l10n/component_library_localizations.dart'; export 'src/theme/font_size.dart'; export 'src/theme/spacing.dart'; @@ -7,4 +6,3 @@ export 'src/theme/golek_theme_data.dart'; export 'src/input_field.dart'; export 'src/input_file.dart'; export 'src/error_message_builder.dart'; -export 'src/favorite_icon_button.dart'; diff --git a/packages/component_library/lib/src/expanded_elevated_button.dart b/packages/component_library/lib/src/expanded_elevated_button.dart deleted file mode 100644 index e2cf33f..0000000 --- a/packages/component_library/lib/src/expanded_elevated_button.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; - -class ExpandedElevatedButton extends StatelessWidget { - static const double _elevatedButtonHeight = 48; - - const ExpandedElevatedButton({ - required this.label, - this.onTap, - this.icon, - Key? key, - }) : super(key: key); - - ExpandedElevatedButton.inProgress({ - required String label, - Key? key, - }) : this( - label: label, - icon: Transform.scale( - scale: 0.5, - child: const CircularProgressIndicator(), - ), - key: key, - ); - - final VoidCallback? onTap; - final String label; - final Widget? icon; - - @override - Widget build(BuildContext context) { - final icon = this.icon; - return SizedBox( - height: _elevatedButtonHeight, - width: double.infinity, - child: icon != null - ? ElevatedButton.icon( - onPressed: onTap, - label: Text( - label, - ), - icon: icon, - ) - : ElevatedButton( - onPressed: onTap, - child: Text( - label, - ), - ), - ); - } -} diff --git a/packages/component_library/lib/src/favorite_icon_button.dart b/packages/component_library/lib/src/favorite_icon_button.dart deleted file mode 100644 index 44092c1..0000000 --- a/packages/component_library/lib/src/favorite_icon_button.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:component_library/component_library.dart'; -import 'package:flutter/material.dart'; - -class FavoriteIconButton extends StatelessWidget { - const FavoriteIconButton({ - required this.isFavorite, - this.onTap, - Key? key, - }) : super(key: key); - - final bool isFavorite; - final VoidCallback? onTap; - - @override - Widget build(BuildContext context) { - final l10n = ComponentLibraryLocalizations.of(context); - return IconButton( - onPressed: onTap, - tooltip: l10n.favoriteIconButtonTooltip, - icon: Icon( - isFavorite ? Icons.favorite : Icons.favorite_border_outlined, - ), - ); - } -} diff --git a/packages/component_library/test/favorite_icon_button_widget_test.dart b/packages/component_library/test/favorite_icon_button_widget_test.dart deleted file mode 100644 index 0a14700..0000000 --- a/packages/component_library/test/favorite_icon_button_widget_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:component_library/component_library.dart'; -import 'package:flutter/material.dart'; - -import 'package:flutter_test/flutter_test.dart'; - -void main() { - group('FavoriteIconButton tests: ', () { - testWidgets('onTap() callback is executed when tapping on button', - (tester) async { - bool value = false; - - await tester.pumpWidget(MaterialApp( - locale: const Locale('en'), - localizationsDelegates: const [ComponentLibraryLocalizations.delegate], - home: Scaffold( - body: FavoriteIconButton( - isFavorite: false, - onTap: () { - value = !value; - }), - ), - )); - - await tester.tap(find.byType(FavoriteIconButton)); - - expect(value, true); - }); - }); -}