Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add button option #5

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions lib/components/button_option.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';

class ButtonOption extends StatelessWidget {
final IconData iconData;
final String text;
final Function()? onPressed;
const ButtonOption(
{super.key, required this.iconData, required this.text, this.onPressed});

@override
Widget build(BuildContext context) {
return SizedBox(
width: 87,
child: InkWell(
onTap: onPressed,
child: Ink(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(iconData, size: 22),
const SizedBox(height: 4),
Text(
text,
style: const TextStyle(
fontWeight: FontWeight.w800,
fontSize: 10,
),
)
],
),
),
),
);
}
}
14 changes: 14 additions & 0 deletions storybook/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:app_flutter/components/bottom_menu.dart';
import 'package:app_flutter/components/button_option.dart';
import 'package:app_flutter/components/cards/book_card.dart';
import 'package:app_flutter/components/header.dart';
import 'package:app_flutter/configs/themes.dart';
Expand Down Expand Up @@ -53,6 +54,19 @@ class StorybookApp extends StatelessWidget {
bottomNavigationBar: BottomMenu(),
),
),
Story(
name: 'Components/ButtonOption',
builder: (context) => Scaffold(
backgroundColor: lightGrey,
body: Center(
child: ButtonOption(
iconData: Icons.home,
text: 'Home',
onPressed: () {},
),
),
),
),
Story(
name: 'Components/BookCard',
builder: (context) => const Scaffold(
Expand Down