Skip to content

Commit

Permalink
fix: tests & build
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Oct 4, 2024
1 parent 7d08c85 commit 4533238
Show file tree
Hide file tree
Showing 42 changed files with 222 additions and 111 deletions.
Binary file added example/assets/font/ubuntu/ubuntu_semibold.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion example/lib/src/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/screen/home/home_screen.dart';
Expand All @@ -19,7 +20,7 @@ class MyAppState extends State<MyApp> {
return ImpaktfullUiApp(
title: 'impaktfull ui',
impaktfullUiTheme: ThemeButton.activeTheme,
flavorBannerText: 'Testing',
flavorBannerText: kDebugMode ? null : 'Prod',
// const is disabled here because it would not rebuild when the theme is set again.
// ignore: prefer_const_constructors
home: HomeScreen(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import 'package:impaktfull_ui_example/src/component_library/components/color_pic
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';
import 'package:impaktfull_ui_example/src/widget/components/components_library_variant_descriptor.dart';

class ColorPickerLibraryVariant extends ComponentLibraryVariant<ColorPickerLibraryPrimaryInputs> {
class ColorPickerLibraryVariant
extends ComponentLibraryVariant<ColorPickerLibraryPrimaryInputs> {
final ImpaktfullUiColorPickerType type;
const ColorPickerLibraryVariant(
this.type,
Expand All @@ -14,7 +15,8 @@ class ColorPickerLibraryVariant extends ComponentLibraryVariant<ColorPickerLibra
String get title => type.name;

@override
List<Widget> build(BuildContext context, ColorPickerLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, ColorPickerLibraryPrimaryInputs inputs) {
return [
ComponentsLibraryVariantDescriptor(
width: 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/icon_button/icon_button_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class IconButtonTypeLibraryVariant extends ComponentLibraryVariant<IconButtonLibraryVariantInputs> {
class IconButtonTypeLibraryVariant
extends ComponentLibraryVariant<IconButtonLibraryVariantInputs> {
IconButtonTypeLibraryVariant();

@override
String get title => 'Default';

@override
List<Widget> build(BuildContext context, IconButtonLibraryVariantInputs inputs) {
List<Widget> build(
BuildContext context, IconButtonLibraryVariantInputs inputs) {
return [
ImpaktfullUiIconButton(
onTap: () => ImpaktfullUiNotification.show(title: 'IconButton tapped'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/list_item/list_item_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class ListItemLibraryVariant extends ComponentLibraryVariant<ListItemLibraryPrimaryInputs> {
class ListItemLibraryVariant
extends ComponentLibraryVariant<ListItemLibraryPrimaryInputs> {
final ImpaktfullUiListItemType type;

const ListItemLibraryVariant(this.type);
Expand All @@ -12,7 +13,8 @@ class ListItemLibraryVariant extends ComponentLibraryVariant<ListItemLibraryPrim
String get title => type.name;

@override
List<Widget> build(BuildContext context, ListItemLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, ListItemLibraryPrimaryInputs inputs) {
return [
ImpaktfullUiListItem(
leading: theme.assets.icons.settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import 'package:impaktfull_ui_example/src/component_library/components/list_view
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';
import 'package:impaktfull_ui_example/src/widget/components/components_library_variant_descriptor.dart';

class ListViewLibraryVariant extends ComponentLibraryVariant<ListViewLibraryPrimaryInputs> {
class ListViewLibraryVariant
extends ComponentLibraryVariant<ListViewLibraryPrimaryInputs> {
const ListViewLibraryVariant();

@override
String get title => 'Default';

@override
List<Widget> build(BuildContext context, ListViewLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, ListViewLibraryPrimaryInputs inputs) {
return [
ComponentsLibraryVariantDescriptor(
height: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/notification_badge/notification_badge_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class NotificationBadgeLibraryVariant extends ComponentLibraryVariant<NotificationBadgeLibraryPrimaryInputs> {
class NotificationBadgeLibraryVariant
extends ComponentLibraryVariant<NotificationBadgeLibraryPrimaryInputs> {
const NotificationBadgeLibraryVariant();

@override
String get title => 'Default';

@override
List<Widget> build(BuildContext context, NotificationBadgeLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, NotificationBadgeLibraryPrimaryInputs inputs) {
return [
ImpaktfullUiNotificationBadge(
show: inputs.show.value ?? false,
Expand All @@ -25,7 +27,9 @@ class NotificationBadgeLibraryVariant extends ComponentLibraryVariant<Notificati
}

@override
NotificationBadgeLibraryPrimaryInputs inputs() => NotificationBadgeLibraryPrimaryInputs();
NotificationBadgeLibraryPrimaryInputs inputs() =>
NotificationBadgeLibraryPrimaryInputs();
}

class NotificationBadgeLibraryPrimaryInputs extends NotificationBadgeLibraryInputs {}
class NotificationBadgeLibraryPrimaryInputs
extends NotificationBadgeLibraryInputs {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ class SidebarNavigationLibraryInputs extends ComponentLibraryInputs {
@override
List<ComponentLibraryInputItem> buildInputItems() => [];
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/sidebar_navigation/sidebar_navigation_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class SidebarNavigationLibraryVariant extends ComponentLibraryVariant<SidebarNavigationLibraryPrimaryInputs> {
class SidebarNavigationLibraryVariant
extends ComponentLibraryVariant<SidebarNavigationLibraryPrimaryInputs> {
const SidebarNavigationLibraryVariant();

@override
String get title => 'Default';

@override
List<Widget> build(BuildContext context, SidebarNavigationLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, SidebarNavigationLibraryPrimaryInputs inputs) {
return [
const ImpaktfullUiSidebarNavigation(),
];
}

@override
SidebarNavigationLibraryPrimaryInputs inputs() => SidebarNavigationLibraryPrimaryInputs();
SidebarNavigationLibraryPrimaryInputs inputs() =>
SidebarNavigationLibraryPrimaryInputs();
}

class SidebarNavigationLibraryPrimaryInputs extends SidebarNavigationLibraryInputs {}
class SidebarNavigationLibraryPrimaryInputs
extends SidebarNavigationLibraryInputs {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import 'package:impaktfull_ui_example/src/component_library/components/sidebar_n
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';
import 'package:impaktfull_ui_example/src/widget/components/components_library_variant_descriptor.dart';

class SidebarNavigationItemLibraryVariant extends ComponentLibraryVariant<SidebarNavigationItemLibraryPrimaryInputs> {
class SidebarNavigationItemLibraryVariant
extends ComponentLibraryVariant<SidebarNavigationItemLibraryPrimaryInputs> {
const SidebarNavigationItemLibraryVariant();

@override
String get title => 'Default';

@override
List<Widget> build(BuildContext context, SidebarNavigationItemLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, SidebarNavigationItemLibraryPrimaryInputs inputs) {
return [
ImpaktfullUiSidebarNavigationItem(
leading: theme.assets.icons.home,
Expand Down Expand Up @@ -90,7 +92,9 @@ class SidebarNavigationItemLibraryVariant extends ComponentLibraryVariant<Sideba
}

@override
SidebarNavigationItemLibraryPrimaryInputs inputs() => SidebarNavigationItemLibraryPrimaryInputs();
SidebarNavigationItemLibraryPrimaryInputs inputs() =>
SidebarNavigationItemLibraryPrimaryInputs();
}

class SidebarNavigationItemLibraryPrimaryInputs extends SidebarNavigationItemLibraryInputs {}
class SidebarNavigationItemLibraryPrimaryInputs
extends SidebarNavigationItemLibraryInputs {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart';
import 'package:impaktfull_ui_example/src/component_library/components/simple_list_item/simple_list_item_library_item.dart';
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';

class SimpleListItemLibraryVariant extends ComponentLibraryVariant<SimpleListItemLibraryPrimaryInputs> {
class SimpleListItemLibraryVariant
extends ComponentLibraryVariant<SimpleListItemLibraryPrimaryInputs> {
final ImpaktfullUiSimpleListItemType type;

const SimpleListItemLibraryVariant(
Expand All @@ -14,7 +15,8 @@ class SimpleListItemLibraryVariant extends ComponentLibraryVariant<SimpleListIte
String get title => type.name;

@override
List<Widget> build(BuildContext context, SimpleListItemLibraryPrimaryInputs inputs) {
List<Widget> build(
BuildContext context, SimpleListItemLibraryPrimaryInputs inputs) {
return [
ImpaktfullUiSimpleListItem(
title: 'Settings',
Expand All @@ -37,7 +39,8 @@ class SimpleListItemLibraryVariant extends ComponentLibraryVariant<SimpleListIte
}

@override
SimpleListItemLibraryPrimaryInputs inputs() => SimpleListItemLibraryPrimaryInputs();
SimpleListItemLibraryPrimaryInputs inputs() =>
SimpleListItemLibraryPrimaryInputs();
}

class SimpleListItemLibraryPrimaryInputs extends SimpleListItemLibraryInputs {}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class TableVariant extends ComponentLibraryVariant<TableLibraryVariantInputs> {
ImpaktfullUiTableRowItem.text(title: 'Value $i'),
ImpaktfullUiTableRowItem.badge(
title: i % 2 == 0 ? 'Paid' : 'Failed',
badgeType: i % 2 == 0 ? ImpaktfullUiBadgeType.success : ImpaktfullUiBadgeType.error,
badgeType: i % 2 == 0
? ImpaktfullUiBadgeType.success
: ImpaktfullUiBadgeType.error,
),
],
),
Expand Down Expand Up @@ -80,7 +82,9 @@ class TableVariant extends ComponentLibraryVariant<TableLibraryVariantInputs> {
columnConfig: columnConfig,
columns: [
ImpaktfullUiTableRowItem.checkbox(
isSelected: inputs.selectedAll.value == true ? true : i == inputs.selectedIndex.value,
isSelected: inputs.selectedAll.value == true
? true
: i == inputs.selectedIndex.value,
onChanged: (value) {
inputs.selectedIndex.toggle(i);

Expand All @@ -97,7 +101,8 @@ class TableVariant extends ComponentLibraryVariant<TableLibraryVariantInputs> {
ImpaktfullUiTableRowItem.badge(title: 'Value $i'),
ImpaktfullUiTableRowItem.text(title: 'Value $i'),
ImpaktfullUiTableRowItem.custom(
builder: (context, theme) => ImpaktfullUiAutoLayout.horizontal(
builder: (context, theme) =>
ImpaktfullUiAutoLayout.horizontal(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ImpaktfullUiIconButton(
Expand All @@ -114,7 +119,8 @@ class TableVariant extends ComponentLibraryVariant<TableLibraryVariantInputs> {
},
size: 20,
color: Colors.green,
asset: ImpaktfullUiAsset.icon(PhosphorIcons.sealCheck()),
asset:
ImpaktfullUiAsset.icon(PhosphorIcons.sealCheck()),
),
ImpaktfullUiIconButton(
onTap: () {
Expand All @@ -129,15 +135,17 @@ class TableVariant extends ComponentLibraryVariant<TableLibraryVariantInputs> {
);
},
size: 20,
asset: ImpaktfullUiAsset.icon(PhosphorIcons.pencilSimple()),
asset: ImpaktfullUiAsset.icon(
PhosphorIcons.pencilSimple()),
),
ImpaktfullUiIconButton(
onTap: () {
SnackyController.instance.cancelAll();
SnackyController.instance.showMessage(
(context) => const Snacky(
title: 'Failed to delete',
subtitle: 'It is not possible to delete this item',
subtitle:
'It is not possible to delete this item',
type: SnackyType.error,
canBeClosed: true,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import 'package:impaktfull_ui_example/src/component_library/components/tooltip/t
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class TooltipLibraryVariant extends ComponentLibraryVariant<TooltipLibraryPrimaryInputs> {
class TooltipLibraryVariant
extends ComponentLibraryVariant<TooltipLibraryPrimaryInputs> {
const TooltipLibraryVariant();

@override
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/screen/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class HomeScreen extends StatelessWidget {
type: ImpaktfullUiButtonType.primary,
title: 'Components',
fullWidth: true,
onTap: () =>
Navigator.of(context).push(NativePageRoute(builder: (context) => const ComponentsLibraryScreen())),
onTap: () => Navigator.of(context).push(NativePageRoute(
builder: (context) => const ComponentsLibraryScreen())),
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion example/lib/src/widget/base/base_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class BaseScreen extends StatelessWidget {
children: [
ImpaktfullUiCmsHeader(
title: title,
onBackTapped: canGoBack ? () => Navigator.of(context).pop() : null,
onBackTapped:
canGoBack ? () => Navigator.of(context).pop() : null,
actions: actions,
bottom: headerBottom,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ class ComponentsLibraryVariantDescriptor extends StatelessWidget {
if (text != null) ...[
Text(
text,
style: ImpaktfullUiTheme.of(context).textStyles.onCanvas.text.extraSmall,
style: ImpaktfullUiTheme.of(context)
.textStyles
.onCanvas
.text
.extraSmall,
),
],
SizedBox(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/widget/theme/theme_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class _ThemeButtonState extends State<ThemeButton> {
var _selectedThemeIndex = 0;

static final _themes = [
ImpaktfullUiTheme.getDefault(),
ImpaktfullUiTheme.custom(
label: 'Impaktfull Dark Theme',
primary: const Color(0xFF1A1A1A),
Expand All @@ -26,7 +27,6 @@ class _ThemeButtonState extends State<ThemeButton> {
textOnAccent: const Color(0xFFFFFFFF),
textOnSecondary: const Color(0xFFFFFFFF),
),
ImpaktfullUiTheme.getDefault(),
ImpaktfullUiTheme.custom(
label: 'Blue theme',
primary: const Color.fromARGB(255, 255, 255, 255),
Expand Down
12 changes: 8 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ flutter:
- asset: assets/font/ubuntu/ubuntu_light.ttf
weight: 300
- asset: assets/font/ubuntu/ubuntu_regular.ttf
- asset: assets/font/ubuntu/ubuntu_medium.ttf
weight: 500
- asset: assets/font/ubuntu/ubuntu_medium.ttf
weight: 600
- asset: assets/font/ubuntu/ubuntu_bold.ttf
weight: 700
- family: Geologica
fonts:
- asset: assets/font/geologica/geologica-light.ttf
- asset: assets/font/geologica/geologica_light.ttf
weight: 300
- asset: assets/font/geologica/geologica-regular.ttf
- asset: assets/font/geologica/geologica-medium.ttf
- asset: assets/font/geologica/geologica_regular.ttf
- asset: assets/font/geologica/geologica_medium.ttf
weight: 500
- asset: assets/font/geologica/geologica_semibold.ttf
weight: 600
- asset: assets/font/geologica/geologica-bold.ttf
- asset: assets/font/geologica/geologica_bold.ttf
weight: 700
6 changes: 4 additions & 2 deletions lib/src/components/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ class ImpaktfullUiApp extends StatelessWidget {
home: home,
debugShowCheckedModeBanner: showDebugFlag,
locale: locale,
theme: (materialLightTheme ?? Theme.of(context)).removeUnwantedBehavior(
theme: (materialLightTheme ?? Theme.of(context))
.removeUnwantedBehavior(
targetPlatform: targetPlatform,
),
darkTheme: (materialLightTheme ?? Theme.of(context)).removeUnwantedBehavior(
darkTheme: (materialLightTheme ?? Theme.of(context))
.removeUnwantedBehavior(
targetPlatform: targetPlatform,
),
supportedLocales: supportedLocales,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/components/bottom_sheet/bottom_sheet_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class ImpaktfullUiBottomSheetTheme extends ImpaktfullUiComponentTheme {
required this.textStyles,
});

static ImpaktfullUiBottomSheetTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.bottomSheet;
static ImpaktfullUiBottomSheetTheme of(BuildContext context) =>
ImpaktfullUiTheme.of(context).components.bottomSheet;
}

class ImpaktfullUiBottomSheetAssetsTheme {
Expand Down
Loading

0 comments on commit 4533238

Please sign in to comment.