Skip to content

Commit

Permalink
Merge pull request #119 from Prime-Holding/feature/small-button-icon-…
Browse files Browse the repository at this point in the history
…type

Implement new SmallButton type widget
  • Loading branch information
JvnSlv authored Aug 12, 2024
2 parents b92fe46 + c26d514 commit f11a3af
Show file tree
Hide file tree
Showing 41 changed files with 69 additions and 22 deletions.
3 changes: 3 additions & 0 deletions packages/widget_toolkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.1.1]
- Added `SmallButtonType.icon` type to `SmallButton` widget

## [0.1.0]
- Fixed loading state of 'SmallButton' widget
### Breaking changes:
Expand Down
2 changes: 1 addition & 1 deletion packages/widget_toolkit/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
22 changes: 19 additions & 3 deletions packages/widget_toolkit/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,25 @@ class CommonComponentsPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 15),
child: SmallButton(
onPressed: () {},
icon: Icons.home_work_outlined,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SmallButton(
onPressed: () {},
type: SmallButtonType.icon,
icon: Icons.home_work_outlined,
),
SmallButton(
onPressed: () {},
type: SmallButtonType.outline,
icon: Icons.home_work_outlined,
),
SmallButton(
onPressed: () {},
type: SmallButtonType.filled,
icon: Icons.home_work_outlined,
),
],
),
),
],
Expand Down
24 changes: 12 additions & 12 deletions packages/widget_toolkit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -385,18 +385,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.15.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -582,10 +582,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.2"
theme_tailor_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -710,10 +710,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.2.4"
watcher:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../sized_loading_indicator.dart';
import 'button_color_style.dart';
import 'button_state.dart';

enum SmallButtonType { filled, outline }
enum SmallButtonType { filled, outline, icon }

class SmallButton extends StatelessWidget {
final String? tooltip;
Expand Down Expand Up @@ -122,6 +122,16 @@ class SmallButton extends StatelessWidget {
onPressed: onPressed,
child: icon,
);
case SmallButtonType.icon:
return IconButton(
style: IconButton.styleFrom(
padding: const EdgeInsets.all(0),
shape: const CircleBorder(),
fixedSize: const Size(48, 48),
),
icon: icon,
onPressed: onPressed,
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/widget_toolkit/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: widget_toolkit
description: The Widget Toolkit package consists of several lightweight and customisable UI components that boost productivity and reduce the development time.
version: 0.1.0
version: 0.1.1
repository: https://github.com/Prime-Holding/widget_toolkit/tree/master/packages/widget_toolkit
issue_tracker: https://github.com/orgs/Prime-Holding/projects/6
homepage: https://www.primeholding.com
Expand Down
4 changes: 2 additions & 2 deletions packages/widget_toolkit/test/helpers/golden_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ void runGoldenBuilderTests(
...GlobalMaterialLocalizations.delegates,
],
theme: theme == Themes.light
? ThemeData(
? ThemeData.light().copyWith(
extensions: <ThemeExtension<dynamic>>[
WidgetToolkitTheme.light(),
],
)
: ThemeData(
: ThemeData.dark().copyWith(
extensions: <ThemeExtension<dynamic>>[
WidgetToolkitTheme.dark(),
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import 'package:widget_toolkit/ui_components.dart';
Widget smallButtonFactory({
required ButtonStateModel state,
required SmallButtonType type,
ButtonColorStyle? colorStyle,
}) =>
SmallButton(
onPressed: () {},
icon: Icons.add,
state: state,
type: type,
colorStyle: colorStyle,
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../factory/small_button_factory.dart';
void main() {
runGoldenBuilderTests(
'small_button_golden_tests',
surfaceSize: const Size(700, 350),
surfaceSize: const Size(700, 500),
matcherCustomPump: (widget) =>
widget.pump(const Duration(milliseconds: 350)),
builder: GoldenBuilder.grid(
Expand Down Expand Up @@ -46,6 +46,22 @@ void main() {
..addScenario(
'pressed outlined',
smallButtonFactory(
type: SmallButtonType.outline, state: ButtonStateModel.pressed)),
type: SmallButtonType.outline, state: ButtonStateModel.pressed))
..addScenario(
'loading icon',
smallButtonFactory(
type: SmallButtonType.icon, state: ButtonStateModel.loading))
..addScenario(
'enabled icon',
smallButtonFactory(
type: SmallButtonType.icon, state: ButtonStateModel.enabled))
..addScenario(
'disabled icon',
smallButtonFactory(
type: SmallButtonType.icon, state: ButtonStateModel.disabled))
..addScenario(
'pressed icon',
smallButtonFactory(
type: SmallButtonType.icon, state: ButtonStateModel.pressed)),
);
}

0 comments on commit f11a3af

Please sign in to comment.