Skip to content

Commit

Permalink
Added sample and docs for FButton.icon
Browse files Browse the repository at this point in the history
  • Loading branch information
John Doe authored and Pante committed Aug 4, 2024
1 parent 8f5f2ff commit 59f02b3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
20 changes: 18 additions & 2 deletions docs/pages/docs/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ FButton.raw(
</Tabs.Tab>
</Tabs>

### With Icon
### With Text+Icon
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='button' variant='icon' query={{}}/>
Expand All @@ -117,4 +117,20 @@ FButton.raw(
),
```
</Tabs.Tab>
</Tabs>
</Tabs>

### With Only Icon
<Tabs items={['Preview', 'Code']}>
<Tabs.Tab>
<Widget name='button' variant='only-icon' query={{}}/>
</Tabs.Tab>
<Tabs.Tab>
```dart {2}
FButton.icon(
icon: FButtonIcon(icon: FAssets.icons.chevronRight),
onPress: () {},
),
```
</Tabs.Tab>
</Tabs>

2 changes: 2 additions & 0 deletions forui/lib/src/widgets/divider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ final class FDividerStyle with Diagnosticable {
..add(DiagnosticsProperty('padding', padding))
..add(ColorProperty('color', color))
..add(DoubleProperty('width', width));

FButton.icon(onPress: (){}, icon: FButtonIcon(icon: FAssets.icons.arrowRight),);
}

@override
Expand Down
5 changes: 5 additions & 0 deletions samples/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart' hide DialogRoute;

import 'package:auto_route/auto_route.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:forui/forui.dart';

import 'package:forui_samples/main.gr.dart';
import 'package:forui_samples/sample_scaffold.dart';
Expand Down Expand Up @@ -71,6 +72,10 @@ class _AppRouter extends RootStackRouter {
path: '/button/icon',
page: ButtonIconRoute.page,
),
AutoRoute(
path: '/button/only-icon',
page: ButtonOnlyIconRoute.page,
),
AutoRoute(
path: '/calendar/default',
page: CalendarRoute.page,
Expand Down
15 changes: 15 additions & 0 deletions samples/lib/widgets/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,18 @@ class ButtonIconPage extends SampleScaffold {
),
);
}

@RoutePage()
class ButtonOnlyIconPage extends SampleScaffold {
ButtonOnlyIconPage({
@queryParam super.theme,
});

@override
Widget child(BuildContext context) => IntrinsicWidth(
child: FButton.icon(
icon: FButtonIcon(icon: FAssets.icons.chevronRight),
onPress: () {},
),
);
}

0 comments on commit 59f02b3

Please sign in to comment.