From 3487e11a804a0d0ac24f85dfa4688e30c516121c Mon Sep 17 00:00:00 2001 From: John Doe Date: Sat, 3 Aug 2024 22:50:45 +0530 Subject: [PATCH] Added sample and docs for FButton.icon --- docs/pages/docs/button.mdx | 20 ++++++++++++++++++-- forui/lib/src/widgets/divider.dart | 2 ++ samples/lib/main.dart | 5 +++++ samples/lib/widgets/button.dart | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/pages/docs/button.mdx b/docs/pages/docs/button.mdx index cd7ad8e0a..6880f766f 100644 --- a/docs/pages/docs/button.mdx +++ b/docs/pages/docs/button.mdx @@ -103,7 +103,7 @@ FButton.raw( -### With Icon +### With Text+Icon @@ -117,4 +117,20 @@ FButton.raw( ), ``` - \ No newline at end of file + + +### With Only Icon + + + + + + ```dart {2} + FButton.icon( + icon: FButtonIcon(icon: FAssets.icons.chevronRight), + onPress: () {}, + ), + ``` + + + diff --git a/forui/lib/src/widgets/divider.dart b/forui/lib/src/widgets/divider.dart index 803413b87..8940ddf45 100644 --- a/forui/lib/src/widgets/divider.dart +++ b/forui/lib/src/widgets/divider.dart @@ -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 diff --git a/samples/lib/main.dart b/samples/lib/main.dart index ab3a9f55d..729ebc81d 100644 --- a/samples/lib/main.dart +++ b/samples/lib/main.dart @@ -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'; @@ -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, diff --git a/samples/lib/widgets/button.dart b/samples/lib/widgets/button.dart index 5ade2741e..a59a73378 100644 --- a/samples/lib/widgets/button.dart +++ b/samples/lib/widgets/button.dart @@ -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: () {}, + ), + ); +}