refractor: migrate components in right package

This commit is contained in:
AN12345
2022-12-07 14:56:05 -05:00
parent cf9f1ddb65
commit a20e4a1715
17 changed files with 21 additions and 39 deletions
@@ -14,12 +14,8 @@
// 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 'package:flutter/material.dart';
import 'package:wyatt_wyatt_ui_components/wyatt_wyatt_ui_components.dart';
void main() {
runApp(const MyApp());
}
@@ -39,9 +35,8 @@ class MyApp extends StatelessWidget {
appBar: AppBar(
title: const Text('Wyatt Ui Components Example'),
),
body: Center(child: Text(wyatt())),
body: const Center(child: Text('')),
),
);
}
}
@@ -32,7 +32,7 @@ dependencies:
sdk: flutter
wyatt_wyatt_ui_components:
wyatt_ui_components:
path: "../"
dev_dependencies:
@@ -0,0 +1,17 @@
// Copyright (C) 2022 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/>.
export 'extensions/build_context_extensions.dart';
@@ -0,0 +1,22 @@
// Copyright (C) 2022 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 'package:flutter/material.dart';
import 'package:wyatt_ui_components/src/features/features.dart';
extension ThemeComponentBuildContext on BuildContext {
ComponentThemeData get components => ComponentTheme.of(this);
}
@@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
String wyatt() => "wyatt_wyatt_ui_components";
export 'entities/components.dart';
@@ -0,0 +1,43 @@
// Copyright (C) 2022 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 'package:flutter/material.dart';
abstract class AppBarComponent extends PreferredSize {
final String? title;
const AppBarComponent({this.title, super.key})
: super(
preferredSize: const Size.fromHeight(60),
child: const SizedBox.shrink(),
);
AppBarComponent configure({String? title});
}
abstract class BottomNavigationBarComponent extends StatelessWidget {
final int currentIndex;
final void Function(BuildContext, int)? onTap;
const BottomNavigationBarComponent({
this.onTap,
this.currentIndex = 0,
super.key,
});
BottomNavigationBarComponent configure({
void Function(BuildContext, int)? onTap,
int currentIndex = 0,
});
}
@@ -0,0 +1,58 @@
// Copyright (C) 2022 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 'package:flutter/material.dart';
import 'package:wyatt_ui_components/src/features/features.dart';
class ComponentTheme extends StatelessWidget {
final Widget child;
final ComponentThemeData componentThemeWidget;
const ComponentTheme({
required this.child,
required this.componentThemeWidget,
super.key,
});
static ComponentThemeData of(BuildContext context) {
final _InheritedComponentTheme? inheritedThemeComponent =
context.dependOnInheritedWidgetOfExactType<_InheritedComponentTheme>();
assert(
inheritedThemeComponent != null,
'Theme component not find in tree',
);
return inheritedThemeComponent!.themeWidget.componentThemeWidget;
}
@override
Widget build(BuildContext context) => _InheritedComponentTheme(
this,
child: child,
);
}
class _InheritedComponentTheme extends InheritedWidget {
final ComponentTheme themeWidget;
const _InheritedComponentTheme(
this.themeWidget, {
required super.child,
});
@override
bool updateShouldNotify(covariant InheritedWidget oldWidget) =>
oldWidget != this;
}
@@ -0,0 +1,27 @@
// Copyright (C) 2022 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 'package:wyatt_ui_components/src/domain/entities/components.dart';
class ComponentThemeData {
final AppBarComponent appBar;
final BottomNavigationBarComponent bottomNavigationBar;
const ComponentThemeData.raw({
required this.appBar,
required this.bottomNavigationBar,
});
}
@@ -0,0 +1,18 @@
// Copyright (C) 2022 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/>.
export 'component_theme_data.dart';
export 'component_theme.dart';
@@ -14,4 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'package.dart';
export 'core/core.dart';
export 'core/core.dart';
export 'domain/domain.dart';
export 'features/features.dart';
@@ -15,6 +15,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// Wyatt Ui Components
library wyatt_wyatt_ui_components;
library wyatt_ui_components;
export 'src/src.dart';
+2 -4
View File
@@ -1,6 +1,6 @@
name: wyatt_wyatt_ui_components
name: wyatt_ui_components
description: Primary ui components
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_wyatt_ui_components
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_ui_components
version: 0.0.1
environment:
@@ -10,8 +10,6 @@ dependencies:
flutter:
sdk: flutter
http: ^0.13.4
dev_dependencies: