-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1af7cf3
commit 7958f2e
Showing
22 changed files
with
597 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"android":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"macos":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"linux":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"windows":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"web":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","dependencies":[]}]},"dependencyGraph":[{"name":"rive_common","dependencies":[]}],"date_created":"2024-10-04 13:48:26.978666","version":"3.24.1","swift_package_manager_enabled":false} | ||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"android":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"macos":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"linux":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"windows":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","native_build":true,"dependencies":[]}],"web":[{"name":"rive_common","path":"/Users/vanlooverenkoen/.pub-cache/hosted/pub.dev/rive_common-0.4.11/","dependencies":[]}]},"dependencyGraph":[{"name":"rive_common","dependencies":[]}],"date_created":"2024-10-04 15:51:00.531304","version":"3.24.1","swift_package_manager_enabled":false} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
example/lib/src/component_library/components/command_menu/command_menu_library_item.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'package:impaktfull_ui_example/src/component_library/components/command_menu/command_menu_library_variant.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/config/component_library_inputs.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/inputs/component_library_boolean_input.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/inputs/component_library_string_input.dart'; | ||
|
||
class CommandMenuLibraryItem extends ComponentLibraryItem { | ||
const CommandMenuLibraryItem(); | ||
|
||
@override | ||
String get title => 'ImpaktfullUiCommandMenu'; | ||
|
||
@override | ||
List<ComponentLibraryVariant> getComponentVariants() { | ||
return [ | ||
const CommandMenuLibraryVariant(), | ||
]; | ||
} | ||
} | ||
|
||
class CommandMenuLibraryInputs extends ComponentLibraryInputs { | ||
final ComponentLibraryStringInput input = | ||
ComponentLibraryStringInput('Search value'); | ||
final ComponentLibraryBoolInput blurBackground = | ||
ComponentLibraryBoolInput('Blur background'); | ||
@override | ||
List<ComponentLibraryInputItem> buildInputItems() => [ | ||
input, | ||
blurBackground, | ||
]; | ||
} |
72 changes: 72 additions & 0 deletions
72
example/lib/src/component_library/components/command_menu/command_menu_library_variant.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:impaktfull_ui_2/impaktfull_ui.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/components/command_menu/command_menu_library_item.dart'; | ||
import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart'; | ||
|
||
class CommandMenuLibraryVariant | ||
extends ComponentLibraryVariant<CommandMenuLibraryPrimaryInputs> { | ||
const CommandMenuLibraryVariant(); | ||
|
||
@override | ||
String get title => 'Default'; | ||
|
||
@override | ||
List<Widget> build( | ||
BuildContext context, CommandMenuLibraryPrimaryInputs inputs) { | ||
return [ | ||
ImpaktfullUiCommandMenu( | ||
shortcutActivator: const SingleActivator( | ||
LogicalKeyboardKey.keyK, | ||
meta: true, | ||
), | ||
builder: (context, theme, controller) => CommandMenuWindow( | ||
onCloseWindow: () => controller.hide(), | ||
onInputChanged: (value) => inputs.input.updateState(value), | ||
hasBlurredBackground: inputs.blurBackground.value ?? false, | ||
padding: EdgeInsets.zero, | ||
marginInputField: const EdgeInsetsDirectional.all(16), | ||
bottomBuilder: (context) { | ||
if (inputs.input.value == null || inputs.input.value!.isEmpty) { | ||
return null; | ||
} | ||
return ImpaktfullUiListView.builder( | ||
items: List.generate(100, (i) => '${inputs.input.value}: $i'), | ||
itemBuilder: (context, item, index) => ImpaktfullUiListItem( | ||
title: item, | ||
onTap: () { | ||
ImpaktfullUiNotification.show(title: 'On $item tapped'); | ||
controller.hide(); | ||
}, | ||
), | ||
noDataLabel: 'No data found', | ||
); | ||
}, | ||
), | ||
child: Focus( | ||
autofocus: true, | ||
child: Container( | ||
color: theme.colors.accent, | ||
width: double.infinity, | ||
height: 500, | ||
padding: const EdgeInsets.all(16), | ||
alignment: Alignment.center, | ||
child: Center( | ||
child: ImpaktfullUiInputField( | ||
value: '', | ||
hint: | ||
'If you are inside this input field, you can use the keyboard shortcut to open the command menu (cmd +k or win +)', | ||
onChanged: (value) {}, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
]; | ||
} | ||
|
||
@override | ||
CommandMenuLibraryPrimaryInputs inputs() => CommandMenuLibraryPrimaryInputs(); | ||
} | ||
|
||
class CommandMenuLibraryPrimaryInputs extends CommandMenuLibraryInputs {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:impaktfull_ui_2/src/components/command_menu/command_menu_style.dart'; | ||
import 'package:impaktfull_ui_2/src/components/command_menu/commander/commander.dart'; | ||
import 'package:impaktfull_ui_2/src/components/theme/theme_component_builder.dart'; | ||
import 'package:impaktfull_ui_2/src/util/descriptor/component_descriptor_mixin.dart'; | ||
|
||
export 'command_menu_style.dart'; | ||
|
||
part 'command_menu.describe.dart'; | ||
|
||
class ImpaktfullUiCommandMenu extends StatefulWidget with ComponentDescriptorMixin { | ||
final ShortcutActivator? shortcutActivator; | ||
final Widget child; | ||
final Widget Function(BuildContext context, ImpaktfullUiCommandMenuTheme theme, CommanderController controller) | ||
builder; | ||
final ImpaktfullUiCommandMenuTheme? theme; | ||
|
||
const ImpaktfullUiCommandMenu({ | ||
required this.child, | ||
required this.builder, | ||
this.shortcutActivator, | ||
this.theme, | ||
super.key, | ||
}); | ||
|
||
@override | ||
State<ImpaktfullUiCommandMenu> createState() => _ImpaktfullUiCommandMenuState(); | ||
|
||
@override | ||
String describe(BuildContext context) => _describeInstance(context, this); | ||
} | ||
|
||
class _ImpaktfullUiCommandMenuState extends State<ImpaktfullUiCommandMenu> { | ||
final _commanderController = CommanderController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ImpaktfullUiComponentThemeBuidler<ImpaktfullUiCommandMenuTheme>( | ||
overrideComponentTheme: widget.theme, | ||
builder: (context, theme, componentTheme) { | ||
final shortcutActivator = widget.shortcutActivator; | ||
if (widget.shortcutActivator == null) return widget.child; | ||
return CommanderConfiguratorWidget( | ||
commanderController: _commanderController, | ||
shortcutActivator: shortcutActivator!, | ||
builder: (context) => CallbackShortcuts( | ||
bindings: <ShortcutActivator, VoidCallback>{ | ||
shortcutActivator: () => _commanderController.hide(), | ||
}, | ||
child: widget.builder(context, componentTheme, _commanderController), | ||
), | ||
child: widget.child, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
part of 'command_menu.dart'; | ||
|
||
String _describeInstance( | ||
BuildContext context, ImpaktfullUiCommandMenu instance) { | ||
final descriptor = ComponentDescriptor(); | ||
descriptor.add('theme', instance.theme); | ||
return descriptor.describe(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:impaktfull_ui_2/src/theme/theme.dart'; | ||
|
||
class ImpaktfullUiCommandMenuTheme extends ImpaktfullUiComponentTheme { | ||
final ImpaktfullUiCommandMenuAssetsTheme assets; | ||
final ImpaktfullUiCommandMenuColorTheme colors; | ||
final ImpaktfullUiCommandMenuDimensTheme dimens; | ||
final ImpaktfullUiCommandMenuTextStyleTheme textStyles; | ||
|
||
const ImpaktfullUiCommandMenuTheme({ | ||
required this.assets, | ||
required this.colors, | ||
required this.dimens, | ||
required this.textStyles, | ||
}); | ||
|
||
static ImpaktfullUiCommandMenuTheme of(BuildContext context) => | ||
ImpaktfullUiTheme.of(context).components.commandMenu; | ||
} | ||
|
||
class ImpaktfullUiCommandMenuAssetsTheme { | ||
const ImpaktfullUiCommandMenuAssetsTheme(); | ||
} | ||
|
||
class ImpaktfullUiCommandMenuColorTheme { | ||
const ImpaktfullUiCommandMenuColorTheme(); | ||
} | ||
|
||
class ImpaktfullUiCommandMenuDimensTheme { | ||
final BorderRadiusGeometry windowBorderRadius; | ||
|
||
const ImpaktfullUiCommandMenuDimensTheme({ | ||
required this.windowBorderRadius, | ||
}); | ||
} | ||
|
||
class ImpaktfullUiCommandMenuTextStyleTheme { | ||
const ImpaktfullUiCommandMenuTextStyleTheme(); | ||
} |
Oops, something went wrong.