feat: add new brick for ui_component
This commit is contained in:
parent
00f93aa4ad
commit
7cea909470
25
apps/wyatt_component_template/brickgen.yaml
Normal file
25
apps/wyatt_component_template/brickgen.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
name: wyatt_component_template
|
||||
description: Component with Copy-with annotation.
|
||||
|
||||
version: 0.1.0
|
||||
|
||||
vars:
|
||||
ui_kit_component_name:
|
||||
compilable: UiKitComponentName
|
||||
type: string
|
||||
description: The name used in this UI Kit.
|
||||
default: UiKitComponentName
|
||||
prompt: "What is the name used in this UI Kit?"
|
||||
|
||||
wyatt_ui_component_name:
|
||||
compilable: InformationCardComponent
|
||||
type: string
|
||||
description: The name of the parent widget defined in `wyatt_ui_component`
|
||||
default: InformationCardComponent
|
||||
prompt: "What is the name of the parent widget defined in `wyatt_ui_component`?"
|
||||
|
||||
brickgen:
|
||||
path_to_brickify: wyatt_component_template/lib
|
||||
hooks: true
|
||||
ignore:
|
||||
- ui_kit_component_name.g.dart
|
39
apps/wyatt_component_template/hooks/post_gen.dart
Normal file
39
apps/wyatt_component_template/hooks/post_gen.dart
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mason/mason.dart';
|
||||
|
||||
void removeGitKeepFiles(String targetPath) {
|
||||
if (!FileSystemEntity.isDirectorySync(targetPath)) {
|
||||
throw ArgumentError('Target must be a directory', 'targetPath');
|
||||
}
|
||||
|
||||
Directory(targetPath)
|
||||
.listSync(recursive: true)
|
||||
.whereType<File>()
|
||||
.forEach((file) {
|
||||
if (file.path.contains('.gitkeep')) {
|
||||
file.deleteSync(recursive: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> run(HookContext context) async {
|
||||
final workingDirectory = Directory.current.path;
|
||||
removeGitKeepFiles(workingDirectory);
|
||||
}
|
7
apps/wyatt_component_template/hooks/pubspec.yaml
Normal file
7
apps/wyatt_component_template/hooks/pubspec.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
name: hooks
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
mason: any
|
@ -0,0 +1,3 @@
|
||||
# display_name
|
||||
|
||||
Brick generated with `Brickgen`.
|
@ -0,0 +1,20 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
part 'ui_kit_component_name.g.dart';
|
||||
|
||||
@ComponentCopyWithExtension()
|
||||
class UiKitComponentName extends InformationCardComponent
|
||||
with $UiKitComponentNameCWMixin {
|
||||
|
||||
const UiKitComponentName({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'ui_kit_component_name.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// ComponentCopyWithGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class $UiKitComponentNameCWProxyImpl
|
||||
implements $InformationCardComponentCWProxy {
|
||||
const $UiKitComponentNameCWProxyImpl(this._value);
|
||||
final UiKitComponentName _value;
|
||||
@override
|
||||
UiKitComponentName icons(List<Widget>? icons) => this(icons: icons);
|
||||
@override
|
||||
UiKitComponentName title(TextWrapper? title) => this(title: title);
|
||||
@override
|
||||
UiKitComponentName subtitle(TextWrapper? subtitle) =>
|
||||
this(subtitle: subtitle);
|
||||
@override
|
||||
UiKitComponentName body(TextWrapper? body) => this(body: body);
|
||||
@override
|
||||
UiKitComponentName axis(Axis? axis) => this(axis: axis);
|
||||
@override
|
||||
UiKitComponentName radius(double? radius) => this(radius: radius);
|
||||
@override
|
||||
UiKitComponentName padding(double? padding) => this(padding: padding);
|
||||
@override
|
||||
UiKitComponentName borderColors(List<Color>? borderColors) =>
|
||||
this(borderColors: borderColors);
|
||||
@override
|
||||
UiKitComponentName backgroundColor(Color? backgroundColor) =>
|
||||
this(backgroundColor: backgroundColor);
|
||||
@override
|
||||
UiKitComponentName minSize(Size? minSize) => this(minSize: minSize);
|
||||
@override
|
||||
UiKitComponentName maxSize(Size? maxSize) => this(maxSize: maxSize);
|
||||
@override
|
||||
UiKitComponentName shadow(BoxShadow? shadow) => this(shadow: shadow);
|
||||
@override
|
||||
UiKitComponentName background(Widget? background) =>
|
||||
this(background: background);
|
||||
@override
|
||||
UiKitComponentName key(Key? key) => this(key: key);
|
||||
@override
|
||||
UiKitComponentName call({
|
||||
List<Widget>? icons,
|
||||
TextWrapper? title,
|
||||
TextWrapper? subtitle,
|
||||
TextWrapper? body,
|
||||
Axis? axis,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
Color? backgroundColor,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
Widget? background,
|
||||
Key? key,
|
||||
}) =>
|
||||
UiKitComponentName(
|
||||
key: key ?? _value.key,
|
||||
);
|
||||
}
|
||||
|
||||
mixin $UiKitComponentNameCWMixin on Component {
|
||||
$InformationCardComponentCWProxy get copyWith =>
|
||||
$UiKitComponentNameCWProxyImpl(this as UiKitComponentName);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
name: wyatt_component_template
|
||||
description: Component with Copy-with annotation.
|
||||
|
||||
version: 1.0.0
|
||||
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=2.19.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter: { sdk: flutter }
|
||||
wyatt_component_copy_with_extension:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
path: packages/wyatt_component_copy_with_extension
|
||||
wyatt_ui_components:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
path: packages/wyatt_ui_components
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.3.3
|
||||
wyatt_analysis:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
version: ^2.4.0
|
||||
wyatt_component_copy_with_gen:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
path: packages/wyatt_component_copy_with_gen
|
@ -0,0 +1,20 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
|
||||
part '{{#snakeCase}}{{ui_kit_component_name}}{{/snakeCase}}.g.dart';
|
||||
|
||||
@ComponentCopyWithExtension()
|
||||
class {{#pascalCase}}{{ui_kit_component_name}}{{/pascalCase}} extends {{#pascalCase}}{{wyatt_ui_component_name}}{{/pascalCase}}
|
||||
with ${{#pascalCase}}{{ui_kit_component_name}}{{/pascalCase}}CWMixin {
|
||||
|
||||
const {{#pascalCase}}{{ui_kit_component_name}}{{/pascalCase}}({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
18
bricks/wyatt_component_template/brick.yaml
Normal file
18
bricks/wyatt_component_template/brick.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
name: wyatt_component_template
|
||||
description: Component with Copy-with annotation.
|
||||
|
||||
version: 0.1.0
|
||||
|
||||
vars:
|
||||
ui_kit_component_name:
|
||||
type: string
|
||||
description: The name used in this UI Kit.
|
||||
default: UiKitComponentName
|
||||
prompt: What is the name used in this UI Kit?
|
||||
|
||||
wyatt_ui_component_name:
|
||||
type: string
|
||||
description: The name of the parent widget defined in `wyatt_ui_component`
|
||||
default: InformationCardComponent
|
||||
prompt: What is the name of the parent widget defined in `wyatt_ui_component`?
|
||||
|
39
bricks/wyatt_component_template/hooks/post_gen.dart
Normal file
39
bricks/wyatt_component_template/hooks/post_gen.dart
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:mason/mason.dart';
|
||||
|
||||
void removeGitKeepFiles(String targetPath) {
|
||||
if (!FileSystemEntity.isDirectorySync(targetPath)) {
|
||||
throw ArgumentError('Target must be a directory', 'targetPath');
|
||||
}
|
||||
|
||||
Directory(targetPath)
|
||||
.listSync(recursive: true)
|
||||
.whereType<File>()
|
||||
.forEach((file) {
|
||||
if (file.path.contains('.gitkeep')) {
|
||||
file.deleteSync(recursive: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> run(HookContext context) async {
|
||||
final workingDirectory = Directory.current.path;
|
||||
removeGitKeepFiles(workingDirectory);
|
||||
}
|
7
bricks/wyatt_component_template/hooks/pubspec.yaml
Normal file
7
bricks/wyatt_component_template/hooks/pubspec.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
name: hooks
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
mason: any
|
@ -7,3 +7,5 @@ bricks:
|
||||
path: bricks/wyatt_app_template
|
||||
wyatt_package_template:
|
||||
path: bricks/wyatt_package_template
|
||||
wyatt_component_template:
|
||||
path: bricks/wyatt_component_template
|
Loading…
x
Reference in New Issue
Block a user