feat(ui_components): add information_card & quote_card (#126)
This commit is contained in:
parent
f3c3939ba1
commit
bde54e0cf5
@ -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/>.
|
||||
|
||||
include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml
|
||||
include: package:wyatt_analysis/analysis_options.flutter.yaml
|
||||
|
@ -27,8 +27,7 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ComponentTheme(
|
||||
Widget build(BuildContext context) => ComponentTheme(
|
||||
componentThemeWidget: AppThemeComponent.components,
|
||||
child: MaterialApp(
|
||||
title: 'Wyatt Ui Components Example',
|
||||
@ -41,7 +40,6 @@ class MyApp extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Home extends StatelessWidget {
|
||||
const Home({super.key});
|
||||
|
@ -1,15 +0,0 @@
|
||||
// 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/>.
|
@ -15,8 +15,8 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||
|
||||
part 'app_bar_component.g.dart';
|
||||
@ -24,13 +24,13 @@ part 'app_bar_component.g.dart';
|
||||
@ComponentProxyExtension()
|
||||
abstract class AppBarComponent extends Component
|
||||
with CopyWithMixin<$AppBarComponentCWProxy> {
|
||||
final String? title;
|
||||
final Widget? leading;
|
||||
final List<Widget>? actions;
|
||||
const AppBarComponent({
|
||||
this.title,
|
||||
this.leading,
|
||||
this.actions,
|
||||
super.key,
|
||||
});
|
||||
final String? title;
|
||||
final Widget? leading;
|
||||
final List<Widget>? actions;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
// Copyright (C) 2023 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
@ -17,18 +18,17 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
|
||||
part 'bottom_navigation_bar_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class BottomNavigationBarComponent extends Component
|
||||
with CopyWithMixin<$BottomNavigationBarComponentCWProxy> {
|
||||
final int currentIndex;
|
||||
final void Function(BuildContext, int)? onTap;
|
||||
const BottomNavigationBarComponent({
|
||||
this.onTap,
|
||||
this.currentIndex = 0,
|
||||
super.key,
|
||||
});
|
||||
final int currentIndex;
|
||||
final void Function(BuildContext, int)? onTap;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// 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 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||
|
||||
abstract class CardComponent extends Component {
|
||||
const CardComponent({
|
||||
this.radius,
|
||||
this.padding,
|
||||
this.borderColors,
|
||||
this.backgroundColor,
|
||||
this.minSize,
|
||||
this.maxSize,
|
||||
this.shadow,
|
||||
this.isDarkModeEnabled,
|
||||
this.background,
|
||||
super.key,
|
||||
});
|
||||
|
||||
/// Card radius
|
||||
final double? radius;
|
||||
|
||||
/// Padding and gaps of this card
|
||||
final double? padding;
|
||||
|
||||
/// Border gradient color (from left to right)
|
||||
final List<Color>? borderColors;
|
||||
|
||||
/// Card background color
|
||||
final Color? backgroundColor;
|
||||
|
||||
/// Minimum size for this card
|
||||
final Size? minSize;
|
||||
|
||||
/// Maximum size for this card
|
||||
final Size? maxSize;
|
||||
|
||||
/// Drop shadow
|
||||
final BoxShadow? shadow;
|
||||
|
||||
/// Is this component in dark mode or not
|
||||
final bool? isDarkModeEnabled;
|
||||
|
||||
/// Background of the card
|
||||
final Widget? background;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
// 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 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart';
|
||||
|
||||
part 'information_card_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class InformationCardComponent extends CardComponent
|
||||
with CopyWithMixin<$InformationCardComponentCWProxy> {
|
||||
const InformationCardComponent({
|
||||
this.icons,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.body,
|
||||
this.axis = Axis.vertical,
|
||||
super.radius = 12,
|
||||
super.padding = 25,
|
||||
super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)],
|
||||
super.backgroundColor = const Color(0xFFF6F6F6),
|
||||
super.minSize = const Size(330, 230),
|
||||
super.maxSize = const Size(330, 530),
|
||||
super.shadow = const BoxShadow(
|
||||
blurRadius: 30,
|
||||
offset: Offset(0, 5),
|
||||
color: Color.fromRGBO(0, 0, 0, 0.05),
|
||||
),
|
||||
super.isDarkModeEnabled = false,
|
||||
super.background,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Axis? axis;
|
||||
final List<Widget>? icons;
|
||||
final Widget? title;
|
||||
final Widget? subtitle;
|
||||
final Widget? body;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'information_card_component.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// ComponentProxyGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class $InformationCardComponentCWProxy {
|
||||
InformationCardComponent icons(List<Widget>? icons);
|
||||
InformationCardComponent title(Widget? title);
|
||||
InformationCardComponent subtitle(Widget? subtitle);
|
||||
InformationCardComponent body(Widget? body);
|
||||
InformationCardComponent axis(Axis? axis);
|
||||
InformationCardComponent radius(double? radius);
|
||||
InformationCardComponent padding(double? padding);
|
||||
InformationCardComponent borderColors(List<Color>? borderColors);
|
||||
InformationCardComponent backgroundColor(Color? backgroundColor);
|
||||
InformationCardComponent minSize(Size? minSize);
|
||||
InformationCardComponent maxSize(Size? maxSize);
|
||||
InformationCardComponent shadow(BoxShadow? shadow);
|
||||
InformationCardComponent isDarkModeEnabled(bool? isDarkModeEnabled);
|
||||
InformationCardComponent background(Widget? background);
|
||||
InformationCardComponent key(Key? key);
|
||||
InformationCardComponent call({
|
||||
List<Widget>? icons,
|
||||
Widget? title,
|
||||
Widget? subtitle,
|
||||
Widget? body,
|
||||
Axis? axis,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
Color? backgroundColor,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
bool? isDarkModeEnabled,
|
||||
Widget? background,
|
||||
Key? key,
|
||||
});
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/cards/card_component.dart';
|
||||
|
||||
part 'quote_card_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class QuoteCardComponent extends CardComponent
|
||||
with CopyWithMixin<$QuoteCardComponentCWProxy> {
|
||||
const QuoteCardComponent({
|
||||
required this.avatar,
|
||||
required this.name,
|
||||
required this.subtitle,
|
||||
required this.gradient,
|
||||
required this.quote,
|
||||
this.leftQuote,
|
||||
this.rightQuote,
|
||||
super.radius = 12,
|
||||
super.padding = 25,
|
||||
super.borderColors = const [Color(0xFFDDE0E3), Color(0xFFCACCD4)],
|
||||
super.backgroundColor = const Color(0xFFF6F6F6),
|
||||
super.minSize = const Size(330, 230),
|
||||
super.maxSize = const Size(330, 530),
|
||||
super.shadow = const BoxShadow(
|
||||
blurRadius: 30,
|
||||
offset: Offset(0, 5),
|
||||
color: Color.fromRGBO(0, 0, 0, 0.05),
|
||||
),
|
||||
super.isDarkModeEnabled = false,
|
||||
super.background,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Widget avatar;
|
||||
final Widget name;
|
||||
final Text subtitle;
|
||||
final Gradient gradient;
|
||||
final Widget quote;
|
||||
|
||||
final Widget? leftQuote;
|
||||
final Widget? rightQuote;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'quote_card_component.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// ComponentProxyGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class $QuoteCardComponentCWProxy {
|
||||
QuoteCardComponent avatar(Widget? avatar);
|
||||
QuoteCardComponent name(Widget? name);
|
||||
QuoteCardComponent subtitle(Text? subtitle);
|
||||
QuoteCardComponent gradient(Gradient? gradient);
|
||||
QuoteCardComponent quote(Widget? quote);
|
||||
QuoteCardComponent leftQuote(Widget? leftQuote);
|
||||
QuoteCardComponent rightQuote(Widget? rightQuote);
|
||||
QuoteCardComponent radius(double? radius);
|
||||
QuoteCardComponent padding(double? padding);
|
||||
QuoteCardComponent borderColors(List<Color>? borderColors);
|
||||
QuoteCardComponent backgroundColor(Color? backgroundColor);
|
||||
QuoteCardComponent minSize(Size? minSize);
|
||||
QuoteCardComponent maxSize(Size? maxSize);
|
||||
QuoteCardComponent shadow(BoxShadow? shadow);
|
||||
QuoteCardComponent isDarkModeEnabled(bool? isDarkModeEnabled);
|
||||
QuoteCardComponent background(Widget? background);
|
||||
QuoteCardComponent key(Key? key);
|
||||
QuoteCardComponent call({
|
||||
Widget? avatar,
|
||||
Widget? name,
|
||||
Text? subtitle,
|
||||
Gradient? gradient,
|
||||
Widget? quote,
|
||||
Widget? leftQuote,
|
||||
Widget? rightQuote,
|
||||
double? radius,
|
||||
double? padding,
|
||||
List<Color>? borderColors,
|
||||
Color? backgroundColor,
|
||||
Size? minSize,
|
||||
Size? maxSize,
|
||||
BoxShadow? shadow,
|
||||
bool? isDarkModeEnabled,
|
||||
Widget? background,
|
||||
Key? key,
|
||||
});
|
||||
}
|
@ -16,6 +16,6 @@
|
||||
|
||||
export './app_bar_component.dart';
|
||||
export './bottom_navigation_bar_component.dart';
|
||||
export './component.dart';
|
||||
export './error_widget_component.dart';
|
||||
export './loading_widget_component.dart';
|
||||
export './component.dart';
|
||||
|
@ -14,16 +14,16 @@
|
||||
// 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_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
part 'error_widget_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class ErrorWidgetComponent extends Component
|
||||
with CopyWithMixin<$ErrorWidgetComponentCWProxy> {
|
||||
final String? error;
|
||||
const ErrorWidgetComponent({required this.error, super.key});
|
||||
final String? error;
|
||||
}
|
||||
|
@ -15,15 +15,15 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/src/core/mixins/copy_with_mixin.dart';
|
||||
import 'package:wyatt_ui_components/src/domain/entities/component.dart';
|
||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||
|
||||
part 'loading_widget_component.g.dart';
|
||||
|
||||
@ComponentProxyExtension()
|
||||
abstract class LoadingWidgetComponent extends Component
|
||||
with CopyWithMixin<$LoadingWidgetComponentCWProxy> {
|
||||
final Color? color;
|
||||
const LoadingWidgetComponent({required this.color, super.key});
|
||||
final Color? color;
|
||||
}
|
||||
|
@ -18,14 +18,14 @@ 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,
|
||||
});
|
||||
final Widget child;
|
||||
final ComponentThemeData componentThemeWidget;
|
||||
|
||||
static ComponentThemeData of(BuildContext context) {
|
||||
final _InheritedComponentTheme? inheritedThemeComponent =
|
||||
@ -46,11 +46,11 @@ class ComponentTheme extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _InheritedComponentTheme extends InheritedWidget {
|
||||
final ComponentTheme themeWidget;
|
||||
const _InheritedComponentTheme(
|
||||
this.themeWidget, {
|
||||
required super.child,
|
||||
});
|
||||
final ComponentTheme themeWidget;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(covariant InheritedWidget oldWidget) =>
|
||||
|
@ -17,10 +17,6 @@
|
||||
import 'package:wyatt_ui_components/src/domain/entities/entities.dart';
|
||||
|
||||
class ComponentThemeData {
|
||||
final AppBarComponent? appBar;
|
||||
final BottomNavigationBarComponent? bottomNavigationBar;
|
||||
final ErrorWidgetComponent? errorWidget;
|
||||
final LoadingWidgetComponent? loadingWidget;
|
||||
|
||||
const ComponentThemeData.raw({
|
||||
this.appBar,
|
||||
@ -28,4 +24,8 @@ class ComponentThemeData {
|
||||
this.errorWidget,
|
||||
this.loadingWidget,
|
||||
});
|
||||
final AppBarComponent? appBar;
|
||||
final BottomNavigationBarComponent? bottomNavigationBar;
|
||||
final ErrorWidgetComponent? errorWidget;
|
||||
final LoadingWidgetComponent? loadingWidget;
|
||||
}
|
||||
|
@ -14,5 +14,5 @@
|
||||
// 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';
|
||||
export 'component_theme_data.dart';
|
||||
|
@ -3,6 +3,8 @@ description: Primary ui components
|
||||
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_ui_components
|
||||
version: 0.0.1
|
||||
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user