master #81
@ -14,6 +14,6 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export 'top_app_bar_component.dart';
|
|
||||||
export './bottom_navigation_bar_component.dart';
|
export './bottom_navigation_bar_component.dart';
|
||||||
export './top_navigation_bar_component.dart';
|
export './top_navigation_bar_component.dart';
|
||||||
|
export 'top_app_bar_component.dart';
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.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/bars/top_bar_component.dart';
|
import 'package:wyatt_ui_components/src/domain/entities/bars/top_bar_component.dart';
|
||||||
|
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||||
|
|
||||||
part 'top_navigation_bar_component.g.dart';
|
part 'top_navigation_bar_component.g.dart';
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ part 'top_navigation_bar_component.g.dart';
|
|||||||
abstract class TopNavigationBarComponent extends TopBarComponent
|
abstract class TopNavigationBarComponent extends TopBarComponent
|
||||||
with CopyWithMixin<$TopNavigationBarComponentCWProxy> {
|
with CopyWithMixin<$TopNavigationBarComponentCWProxy> {
|
||||||
const TopNavigationBarComponent({
|
const TopNavigationBarComponent({
|
||||||
|
this.navigationItems,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.currentIndex = 0,
|
this.currentIndex = 0,
|
||||||
super.shape,
|
super.shape,
|
||||||
@ -48,6 +50,7 @@ abstract class TopNavigationBarComponent extends TopBarComponent
|
|||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final List<TextWrapper>? navigationItems;
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
final void Function(BuildContext, int)? onTap;
|
final void Function(BuildContext, int)? onTap;
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,54 @@ part of 'top_navigation_bar_component.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
abstract class $TopNavigationBarComponentCWProxy {
|
abstract class $TopNavigationBarComponentCWProxy {
|
||||||
TopNavigationBarComponent leading(Widget? leading);
|
TopNavigationBarComponent navigationItems(List<TextWrapper>? navigationItems);
|
||||||
TopNavigationBarComponent actions(List<Widget>? actions);
|
|
||||||
TopNavigationBarComponent onTap(void Function(BuildContext, int)? onTap);
|
TopNavigationBarComponent onTap(void Function(BuildContext, int)? onTap);
|
||||||
TopNavigationBarComponent currentIndex(int? currentIndex);
|
TopNavigationBarComponent currentIndex(int? currentIndex);
|
||||||
|
TopNavigationBarComponent shape(ShapeBorder? shape);
|
||||||
|
TopNavigationBarComponent systemOverlayStyle(
|
||||||
|
SystemUiOverlayStyle? systemOverlayStyle);
|
||||||
|
TopNavigationBarComponent automaticallyImplyLeading(
|
||||||
|
bool? automaticallyImplyLeading);
|
||||||
|
TopNavigationBarComponent flexibleSpace(Widget? flexibleSpace);
|
||||||
|
TopNavigationBarComponent bottom(PreferredSizeWidget? bottom);
|
||||||
|
TopNavigationBarComponent elevation(double? elevation);
|
||||||
|
TopNavigationBarComponent scrolledUnderElevation(
|
||||||
|
double? scrolledUnderElevation);
|
||||||
|
TopNavigationBarComponent shadowColor(Color? shadowColor);
|
||||||
|
TopNavigationBarComponent surfaceTintColor(Color? surfaceTintColor);
|
||||||
|
TopNavigationBarComponent backgroundColor(MultiColor? backgroundColor);
|
||||||
|
TopNavigationBarComponent iconTheme(IconThemeData? iconTheme);
|
||||||
|
TopNavigationBarComponent primary(bool? primary);
|
||||||
|
TopNavigationBarComponent excludeHeaderSemantics(
|
||||||
|
bool? excludeHeaderSemantics);
|
||||||
|
TopNavigationBarComponent toolbarHeight(double? toolbarHeight);
|
||||||
|
TopNavigationBarComponent leadingWidth(double? leadingWidth);
|
||||||
|
TopNavigationBarComponent leading(Widget? leading);
|
||||||
|
TopNavigationBarComponent actions(List<Widget>? actions);
|
||||||
|
TopNavigationBarComponent expandedWidget(List<Widget>? expandedWidget);
|
||||||
TopNavigationBarComponent key(Key? key);
|
TopNavigationBarComponent key(Key? key);
|
||||||
TopNavigationBarComponent call({
|
TopNavigationBarComponent call({
|
||||||
Widget? leading,
|
List<TextWrapper>? navigationItems,
|
||||||
List<Widget>? actions,
|
|
||||||
void Function(BuildContext, int)? onTap,
|
void Function(BuildContext, int)? onTap,
|
||||||
int? currentIndex,
|
int? currentIndex,
|
||||||
|
ShapeBorder? shape,
|
||||||
|
SystemUiOverlayStyle? systemOverlayStyle,
|
||||||
|
bool? automaticallyImplyLeading,
|
||||||
|
Widget? flexibleSpace,
|
||||||
|
PreferredSizeWidget? bottom,
|
||||||
|
double? elevation,
|
||||||
|
double? scrolledUnderElevation,
|
||||||
|
Color? shadowColor,
|
||||||
|
Color? surfaceTintColor,
|
||||||
|
MultiColor? backgroundColor,
|
||||||
|
IconThemeData? iconTheme,
|
||||||
|
bool? primary,
|
||||||
|
bool? excludeHeaderSemantics,
|
||||||
|
double? toolbarHeight,
|
||||||
|
double? leadingWidth,
|
||||||
|
Widget? leading,
|
||||||
|
List<Widget>? actions,
|
||||||
|
List<Widget>? expandedWidget,
|
||||||
Key? key,
|
Key? key,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
BIN
packages/wyatt_ui_kit/example/assets/images/studio_long_logo.png
Normal file
BIN
packages/wyatt_ui_kit/example/assets/images/studio_long_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -61,6 +61,28 @@ class Bars extends DemoPage {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const Gap(20),
|
||||||
|
TopNavigationBar(
|
||||||
|
leading: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
child: Image.asset('assets/images/studio_long_logo.png'),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20, vertical: 25),
|
||||||
|
child: FlatButton(
|
||||||
|
label: 'Estimer mon projet'.wrap(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
navigationItems: [
|
||||||
|
'ACCEUIL'.wrap(),
|
||||||
|
'VOTRE PROGRAMME'.wrap(),
|
||||||
|
'LE STUDIO'.wrap(),
|
||||||
|
'SAVOIR FAIRE'.wrap()
|
||||||
|
].whereType<TextWrapper>().toList(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import 'package:wyatt_ui_kit_example/theme/rich_text_builder_theme.dart';
|
|||||||
import 'package:wyatt_ui_kit_example/theme/simple_icon_button_theme.dart';
|
import 'package:wyatt_ui_kit_example/theme/simple_icon_button_theme.dart';
|
||||||
import 'package:wyatt_ui_kit_example/theme/symbol_button_theme.dart';
|
import 'package:wyatt_ui_kit_example/theme/symbol_button_theme.dart';
|
||||||
import 'package:wyatt_ui_kit_example/theme/text_input_theme.dart';
|
import 'package:wyatt_ui_kit_example/theme/text_input_theme.dart';
|
||||||
import 'package:wyatt_ui_kit_example/theme/top_app_bar_theme.dart';
|
import 'package:wyatt_ui_kit_example/theme/top_bar_theme.dart';
|
||||||
|
|
||||||
/// Easely switch between Material and Studio themes.
|
/// Easely switch between Material and Studio themes.
|
||||||
abstract class Themes {
|
abstract class Themes {
|
||||||
|
@ -3,24 +3,31 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||||
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||||
|
|
||||||
class TopAppBarTheme extends TopAppBarThemeExtension {
|
class TopAppBarTheme extends TopBarThemeExtension {
|
||||||
const TopAppBarTheme({
|
const TopAppBarTheme({
|
||||||
super.iconTheme,
|
super.iconTheme,
|
||||||
super.backgroundColors,
|
super.backgroundColors,
|
||||||
super.expandedDividerStyle,
|
super.secondaryColor,
|
||||||
super.titleStyle,
|
super.titleStyle,
|
||||||
|
super.subTitleStyle,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory TopAppBarTheme.light() => TopAppBarTheme(
|
factory TopAppBarTheme.light() => TopAppBarTheme(
|
||||||
backgroundColors: const MultiColor.single(
|
backgroundColors: const MultiColor.single(
|
||||||
Color.fromRGBO(246, 246, 246, 1),
|
Color.fromRGBO(246, 246, 246, 1),
|
||||||
),
|
),
|
||||||
expandedDividerStyle: Colors.black.withOpacity(0.1),
|
secondaryColor: const Color.fromRGBO(36, 38, 42, 1),
|
||||||
titleStyle: GoogleFonts.montserrat(
|
titleStyle: GoogleFonts.montserrat(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
color: const Color.fromRGBO(36, 38, 42, 1),
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
iconTheme: const IconThemeData(color: Colors.black),
|
subTitleStyle: GoogleFonts.montserrat(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: const Color.fromRGBO(36, 38, 42, 1),
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
iconTheme: const IconThemeData(color: Color.fromRGBO(36, 38, 42, 1)),
|
||||||
);
|
);
|
||||||
|
|
||||||
factory TopAppBarTheme.dark() => TopAppBarTheme(
|
factory TopAppBarTheme.dark() => TopAppBarTheme(
|
||||||
@ -29,31 +36,35 @@ class TopAppBarTheme extends TopAppBarThemeExtension {
|
|||||||
Color.fromRGBO(39, 47, 61, 1),
|
Color.fromRGBO(39, 47, 61, 1),
|
||||||
Color.fromRGBO(44, 50, 56, 1),
|
Color.fromRGBO(44, 50, 56, 1),
|
||||||
]),
|
]),
|
||||||
expandedDividerStyle: Colors.white.withOpacity(0.1),
|
secondaryColor: Colors.white,
|
||||||
titleStyle: GoogleFonts.montserrat(
|
titleStyle: GoogleFonts.montserrat(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
|
subTitleStyle: GoogleFonts.montserrat(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
iconTheme: const IconThemeData(color: Colors.white),
|
iconTheme: const IconThemeData(color: Colors.white),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeExtension<TopAppBarThemeExtension> copyWith({
|
ThemeExtension<TopBarThemeExtension> copyWith({
|
||||||
IconThemeData? iconTheme,
|
IconThemeData? iconTheme,
|
||||||
MultiColor? backgroundColors,
|
MultiColor? backgroundColors,
|
||||||
Color? expandedDividerStyle,
|
Color? secondaryColor,
|
||||||
TextStyle? titleStyle,
|
TextStyle? titleStyle,
|
||||||
}) =>
|
}) =>
|
||||||
TopAppBarTheme(
|
TopAppBarTheme(
|
||||||
iconTheme: iconTheme ?? this.iconTheme,
|
iconTheme: iconTheme ?? this.iconTheme,
|
||||||
backgroundColors: backgroundColors ?? this.backgroundColors,
|
backgroundColors: backgroundColors ?? this.backgroundColors,
|
||||||
expandedDividerStyle: expandedDividerStyle ?? this.expandedDividerStyle,
|
secondaryColor: secondaryColor ?? this.secondaryColor,
|
||||||
titleStyle: titleStyle ?? this.titleStyle,
|
titleStyle: titleStyle ?? this.titleStyle,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeExtension<TopAppBarThemeExtension> lerp(
|
ThemeExtension<TopBarThemeExtension> lerp(
|
||||||
covariant ThemeExtension<TopAppBarThemeExtension>? other,
|
covariant ThemeExtension<TopBarThemeExtension>? other,
|
||||||
double t,
|
double t,
|
||||||
) {
|
) {
|
||||||
if (other is! TopAppBarTheme) {
|
if (other is! TopAppBarTheme) {
|
||||||
@ -63,8 +74,7 @@ class TopAppBarTheme extends TopAppBarThemeExtension {
|
|||||||
iconTheme: IconThemeData.lerp(iconTheme, other.iconTheme, t),
|
iconTheme: IconThemeData.lerp(iconTheme, other.iconTheme, t),
|
||||||
backgroundColors:
|
backgroundColors:
|
||||||
MultiColor.lerp(backgroundColors, other.backgroundColors, t),
|
MultiColor.lerp(backgroundColors, other.backgroundColors, t),
|
||||||
expandedDividerStyle:
|
secondaryColor: Color.lerp(secondaryColor, other.secondaryColor, t),
|
||||||
Color.lerp(expandedDividerStyle, other.expandedDividerStyle, t),
|
|
||||||
titleStyle: TextStyle.lerp(titleStyle, other.titleStyle, t),
|
titleStyle: TextStyle.lerp(titleStyle, other.titleStyle, t),
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -14,4 +14,5 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with super program. If not, see <https://www.gnu.org/licenses/>.
|
// along with super program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export 'top_app_bar.dart';
|
export './top_app_bar.dart';
|
||||||
|
export './top_navigation_bar.dart';
|
@ -24,6 +24,8 @@ part 'top_app_bar.g.dart';
|
|||||||
@ComponentCopyWithExtension()
|
@ComponentCopyWithExtension()
|
||||||
class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
||||||
const TopAppBar({
|
const TopAppBar({
|
||||||
|
super.title,
|
||||||
|
super.centerTitle,
|
||||||
super.systemOverlayStyle,
|
super.systemOverlayStyle,
|
||||||
super.automaticallyImplyLeading,
|
super.automaticallyImplyLeading,
|
||||||
super.flexibleSpace,
|
super.flexibleSpace,
|
||||||
@ -38,10 +40,8 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
super.excludeHeaderSemantics,
|
super.excludeHeaderSemantics,
|
||||||
super.toolbarHeight,
|
super.toolbarHeight,
|
||||||
super.leadingWidth,
|
super.leadingWidth,
|
||||||
super.title,
|
|
||||||
super.leading,
|
super.leading,
|
||||||
super.actions,
|
super.actions,
|
||||||
super.centerTitle,
|
|
||||||
super.shape,
|
super.shape,
|
||||||
super.expandedWidget,
|
super.expandedWidget,
|
||||||
super.key,
|
super.key,
|
||||||
@ -53,9 +53,7 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
gradient: ThemeHelper.getThemeElement<MultiColor, Gradient>(
|
gradient: ThemeHelper.getThemeElement<MultiColor, Gradient>(
|
||||||
[
|
[
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
context
|
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||||
.themeExtension<TopAppBarThemeExtension>()
|
|
||||||
?.backgroundColors,
|
|
||||||
],
|
],
|
||||||
valueValidator: (value) => value?.isGradient,
|
valueValidator: (value) => value?.isGradient,
|
||||||
transform: (value) =>
|
transform: (value) =>
|
||||||
@ -65,9 +63,7 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
color: ThemeHelper.getThemeElement<MultiColor, Color>(
|
color: ThemeHelper.getThemeElement<MultiColor, Color>(
|
||||||
[
|
[
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
context
|
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||||
.themeExtension<TopAppBarThemeExtension>()
|
|
||||||
?.backgroundColors,
|
|
||||||
],
|
],
|
||||||
valueValidator: (value) => value?.isColor,
|
valueValidator: (value) => value?.isColor,
|
||||||
transform: (value) => value?.color,
|
transform: (value) => value?.color,
|
||||||
@ -91,7 +87,7 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
ThemeHelper.getThemeElement<IconThemeData, IconThemeData>(
|
ThemeHelper.getThemeElement<IconThemeData, IconThemeData>(
|
||||||
[
|
[
|
||||||
iconTheme,
|
iconTheme,
|
||||||
context.themeExtension<TopAppBarThemeExtension>()?.iconTheme,
|
context.themeExtension<TopBarThemeExtension>()?.iconTheme,
|
||||||
],
|
],
|
||||||
valueValidator: (value) => value != null,
|
valueValidator: (value) => value != null,
|
||||||
transform: (value) => value,
|
transform: (value) => value,
|
||||||
@ -105,9 +101,7 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
style: ThemeHelper.getThemeElement<TextStyle, TextStyle>(
|
style: ThemeHelper.getThemeElement<TextStyle, TextStyle>(
|
||||||
[
|
[
|
||||||
title?.style,
|
title?.style,
|
||||||
context
|
context.themeExtension<TopBarThemeExtension>()?.titleStyle
|
||||||
.themeExtension<TopAppBarThemeExtension>()
|
|
||||||
?.titleStyle
|
|
||||||
],
|
],
|
||||||
valueValidator: (value) => value != null,
|
valueValidator: (value) => value != null,
|
||||||
transform: (value) => value,
|
transform: (value) => value,
|
||||||
@ -123,8 +117,9 @@ class TopAppBar extends TopAppBarComponent with $TopAppBarCWMixin {
|
|||||||
color: ThemeHelper.getThemeElement<Color, Color>(
|
color: ThemeHelper.getThemeElement<Color, Color>(
|
||||||
[
|
[
|
||||||
context
|
context
|
||||||
.themeExtension<TopAppBarThemeExtension>()
|
.themeExtension<TopBarThemeExtension>()
|
||||||
?.expandedDividerStyle,
|
?.secondaryColor
|
||||||
|
?.withOpacity(0.1),
|
||||||
],
|
],
|
||||||
valueValidator: (value) => value != null,
|
valueValidator: (value) => value != null,
|
||||||
transform: (value) => value,
|
transform: (value) => value,
|
@ -86,6 +86,8 @@ class $TopAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
|
|||||||
Key? key,
|
Key? key,
|
||||||
}) =>
|
}) =>
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
|
title: title ?? _value.title,
|
||||||
|
centerTitle: centerTitle ?? _value.centerTitle,
|
||||||
systemOverlayStyle: systemOverlayStyle ?? _value.systemOverlayStyle,
|
systemOverlayStyle: systemOverlayStyle ?? _value.systemOverlayStyle,
|
||||||
automaticallyImplyLeading:
|
automaticallyImplyLeading:
|
||||||
automaticallyImplyLeading ?? _value.automaticallyImplyLeading,
|
automaticallyImplyLeading ?? _value.automaticallyImplyLeading,
|
||||||
@ -103,10 +105,8 @@ class $TopAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
|
|||||||
excludeHeaderSemantics ?? _value.excludeHeaderSemantics,
|
excludeHeaderSemantics ?? _value.excludeHeaderSemantics,
|
||||||
toolbarHeight: toolbarHeight ?? _value.toolbarHeight,
|
toolbarHeight: toolbarHeight ?? _value.toolbarHeight,
|
||||||
leadingWidth: leadingWidth ?? _value.leadingWidth,
|
leadingWidth: leadingWidth ?? _value.leadingWidth,
|
||||||
title: title ?? _value.title,
|
|
||||||
leading: leading ?? _value.leading,
|
leading: leading ?? _value.leading,
|
||||||
actions: actions ?? _value.actions,
|
actions: actions ?? _value.actions,
|
||||||
centerTitle: centerTitle ?? _value.centerTitle,
|
|
||||||
shape: shape ?? _value.shape,
|
shape: shape ?? _value.shape,
|
||||||
expandedWidget: expandedWidget ?? _value.expandedWidget,
|
expandedWidget: expandedWidget ?? _value.expandedWidget,
|
||||||
key: key ?? _value.key,
|
key: key ?? _value.key,
|
@ -0,0 +1,135 @@
|
|||||||
|
// 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/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
||||||
|
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||||
|
import 'package:wyatt_ui_kit/src/components/bars/widgets/navigation_item.dart';
|
||||||
|
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||||
|
|
||||||
|
part 'top_navigation_bar.g.dart';
|
||||||
|
|
||||||
|
@ComponentCopyWithExtension()
|
||||||
|
class TopNavigationBar extends TopNavigationBarComponent
|
||||||
|
with $TopNavigationBarCWMixin {
|
||||||
|
const TopNavigationBar({
|
||||||
|
super.navigationItems,
|
||||||
|
super.onTap,
|
||||||
|
super.currentIndex = 0,
|
||||||
|
super.systemOverlayStyle,
|
||||||
|
super.automaticallyImplyLeading,
|
||||||
|
super.flexibleSpace,
|
||||||
|
super.bottom,
|
||||||
|
super.elevation,
|
||||||
|
super.scrolledUnderElevation,
|
||||||
|
super.shadowColor,
|
||||||
|
super.surfaceTintColor,
|
||||||
|
super.backgroundColor,
|
||||||
|
super.iconTheme,
|
||||||
|
super.primary,
|
||||||
|
super.excludeHeaderSemantics,
|
||||||
|
super.toolbarHeight,
|
||||||
|
super.leadingWidth,
|
||||||
|
super.leading,
|
||||||
|
super.actions,
|
||||||
|
super.shape,
|
||||||
|
super.expandedWidget,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: ThemeHelper.getThemeElement<MultiColor, Gradient>(
|
||||||
|
[
|
||||||
|
backgroundColor,
|
||||||
|
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||||
|
],
|
||||||
|
valueValidator: (value) => value?.isGradient,
|
||||||
|
transform: (value) =>
|
||||||
|
LinearGradientHelper.fromNullableColors(value?.colors),
|
||||||
|
defaultValue: null,
|
||||||
|
),
|
||||||
|
color: ThemeHelper.getThemeElement<MultiColor, Color>(
|
||||||
|
[
|
||||||
|
backgroundColor,
|
||||||
|
context.themeExtension<TopBarThemeExtension>()?.backgroundColors,
|
||||||
|
],
|
||||||
|
valueValidator: (value) => value?.isColor,
|
||||||
|
transform: (value) => value?.color,
|
||||||
|
defaultValue: Theme.of(context).appBarTheme.backgroundColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: AppBar(
|
||||||
|
toolbarHeight: 100,
|
||||||
|
titleSpacing: 0,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
systemOverlayStyle: systemOverlayStyle,
|
||||||
|
automaticallyImplyLeading: automaticallyImplyLeading ?? true,
|
||||||
|
flexibleSpace: flexibleSpace,
|
||||||
|
bottom: bottom,
|
||||||
|
elevation: elevation ?? 0,
|
||||||
|
scrolledUnderElevation: scrolledUnderElevation,
|
||||||
|
shadowColor: shadowColor,
|
||||||
|
surfaceTintColor: surfaceTintColor,
|
||||||
|
iconTheme: ThemeHelper.getThemeElement<IconThemeData, IconThemeData>(
|
||||||
|
[
|
||||||
|
iconTheme,
|
||||||
|
context.themeExtension<TopBarThemeExtension>()?.iconTheme,
|
||||||
|
],
|
||||||
|
valueValidator: (value) => value != null,
|
||||||
|
transform: (value) => value,
|
||||||
|
defaultValue: Theme.of(context).iconTheme,
|
||||||
|
),
|
||||||
|
primary: primary ?? true,
|
||||||
|
excludeHeaderSemantics: excludeHeaderSemantics ?? false,
|
||||||
|
leadingWidth: 200,
|
||||||
|
title: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: navigationItems != null
|
||||||
|
? navigationItems!
|
||||||
|
.asMap()
|
||||||
|
.map<int, Widget>(
|
||||||
|
(key, value) => MapEntry(
|
||||||
|
key,
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
onTap?.call(context, key);
|
||||||
|
},
|
||||||
|
child: NavigationItem(
|
||||||
|
item: value,
|
||||||
|
selected: key == currentIndex,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.values
|
||||||
|
.toList()
|
||||||
|
: [],
|
||||||
|
),
|
||||||
|
leading: leading,
|
||||||
|
actions: actions,
|
||||||
|
centerTitle: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
@ -11,6 +11,9 @@ class $TopNavigationBarCWProxyImpl
|
|||||||
const $TopNavigationBarCWProxyImpl(this._value);
|
const $TopNavigationBarCWProxyImpl(this._value);
|
||||||
final TopNavigationBar _value;
|
final TopNavigationBar _value;
|
||||||
@override
|
@override
|
||||||
|
TopNavigationBar navigationItems(List<TextWrapper>? navigationItems) =>
|
||||||
|
this(navigationItems: navigationItems);
|
||||||
|
@override
|
||||||
TopNavigationBar onTap(void Function(BuildContext, int)? onTap) =>
|
TopNavigationBar onTap(void Function(BuildContext, int)? onTap) =>
|
||||||
this(onTap: onTap);
|
this(onTap: onTap);
|
||||||
@override
|
@override
|
||||||
@ -69,6 +72,7 @@ class $TopNavigationBarCWProxyImpl
|
|||||||
TopNavigationBar key(Key? key) => this(key: key);
|
TopNavigationBar key(Key? key) => this(key: key);
|
||||||
@override
|
@override
|
||||||
TopNavigationBar call({
|
TopNavigationBar call({
|
||||||
|
List<TextWrapper>? navigationItems,
|
||||||
void Function(BuildContext, int)? onTap,
|
void Function(BuildContext, int)? onTap,
|
||||||
int? currentIndex,
|
int? currentIndex,
|
||||||
ShapeBorder? shape,
|
ShapeBorder? shape,
|
||||||
@ -92,10 +96,30 @@ class $TopNavigationBarCWProxyImpl
|
|||||||
Key? key,
|
Key? key,
|
||||||
}) =>
|
}) =>
|
||||||
TopNavigationBar(
|
TopNavigationBar(
|
||||||
leading: leading ?? _value.leading,
|
navigationItems: navigationItems ?? _value.navigationItems,
|
||||||
actions: actions ?? _value.actions,
|
|
||||||
onTap: onTap ?? _value.onTap,
|
onTap: onTap ?? _value.onTap,
|
||||||
currentIndex: currentIndex ?? _value.currentIndex,
|
currentIndex: currentIndex ?? _value.currentIndex,
|
||||||
|
systemOverlayStyle: systemOverlayStyle ?? _value.systemOverlayStyle,
|
||||||
|
automaticallyImplyLeading:
|
||||||
|
automaticallyImplyLeading ?? _value.automaticallyImplyLeading,
|
||||||
|
flexibleSpace: flexibleSpace ?? _value.flexibleSpace,
|
||||||
|
bottom: bottom ?? _value.bottom,
|
||||||
|
elevation: elevation ?? _value.elevation,
|
||||||
|
scrolledUnderElevation:
|
||||||
|
scrolledUnderElevation ?? _value.scrolledUnderElevation,
|
||||||
|
shadowColor: shadowColor ?? _value.shadowColor,
|
||||||
|
surfaceTintColor: surfaceTintColor ?? _value.surfaceTintColor,
|
||||||
|
backgroundColor: backgroundColor ?? _value.backgroundColor,
|
||||||
|
iconTheme: iconTheme ?? _value.iconTheme,
|
||||||
|
primary: primary ?? _value.primary,
|
||||||
|
excludeHeaderSemantics:
|
||||||
|
excludeHeaderSemantics ?? _value.excludeHeaderSemantics,
|
||||||
|
toolbarHeight: toolbarHeight ?? _value.toolbarHeight,
|
||||||
|
leadingWidth: leadingWidth ?? _value.leadingWidth,
|
||||||
|
leading: leading ?? _value.leading,
|
||||||
|
actions: actions ?? _value.actions,
|
||||||
|
shape: shape ?? _value.shape,
|
||||||
|
expandedWidget: expandedWidget ?? _value.expandedWidget,
|
||||||
key: key ?? _value.key,
|
key: key ?? _value.key,
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
// Copyright (C) 2023 WYATT GROUP
|
||||||
|
// Please see the AUTHORS file for details.
|
||||||
|
//
|
||||||
|
// super 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.
|
||||||
|
//
|
||||||
|
// super 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 super program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||||
|
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||||
|
|
||||||
|
class NavigationItem extends StatelessWidget {
|
||||||
|
const NavigationItem({
|
||||||
|
required this.item,
|
||||||
|
required this.selected,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
final TextWrapper item;
|
||||||
|
final bool selected;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => Stack(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
children: [
|
||||||
|
if (selected)
|
||||||
|
Container(
|
||||||
|
height: 5,
|
||||||
|
width: 70,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(100),
|
||||||
|
color: ThemeHelper.getThemeElement<Color, Color>(
|
||||||
|
[
|
||||||
|
context
|
||||||
|
.themeExtension<TopBarThemeExtension>()
|
||||||
|
?.secondaryColor
|
||||||
|
],
|
||||||
|
valueValidator: (value) => value != null,
|
||||||
|
transform: (value) => value,
|
||||||
|
defaultValue: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
item.data,
|
||||||
|
style: ThemeHelper.getThemeElement<TextStyle, TextStyle>(
|
||||||
|
[
|
||||||
|
item.style,
|
||||||
|
context
|
||||||
|
.themeExtension<TopBarThemeExtension>()
|
||||||
|
?.subTitleStyle
|
||||||
|
],
|
||||||
|
valueValidator: (value) => value != null,
|
||||||
|
transform: (value) => value,
|
||||||
|
defaultValue: context.textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
@ -14,10 +14,10 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
export './app_bars/app_bars.dart';
|
|
||||||
export './buttons/buttons.dart';
|
export './buttons/buttons.dart';
|
||||||
export './cards/cards.dart';
|
export './cards/cards.dart';
|
||||||
export './gradients/gradients.dart';
|
export './gradients/gradients.dart';
|
||||||
export './loader/loader.dart';
|
export './loader/loader.dart';
|
||||||
export './rich_text_builder/rich_text_builder.dart';
|
export './rich_text_builder/rich_text_builder.dart';
|
||||||
export './text_inputs/text_input.dart';
|
export './text_inputs/text_input.dart';
|
||||||
|
export 'bars/bars.dart';
|
||||||
|
@ -1,35 +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/>.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:wyatt_component_copy_with_extension/component_copy_with_extension.dart';
|
|
||||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
|
||||||
part 'top_navigation_bar.g.dart';
|
|
||||||
|
|
||||||
@ComponentCopyWithExtension()
|
|
||||||
class TopNavigationBar extends TopNavigationBarComponent
|
|
||||||
with $TopNavigationBarCWMixin {
|
|
||||||
const TopNavigationBar({
|
|
||||||
super.leading,
|
|
||||||
super.actions,
|
|
||||||
super.onTap,
|
|
||||||
super.currentIndex = 0,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => const Placeholder();
|
|
||||||
}
|
|
@ -19,4 +19,4 @@ export './card_theme_extension.dart';
|
|||||||
export './loader_theme_extension.dart';
|
export './loader_theme_extension.dart';
|
||||||
export './rich_text_builder_theme_extension.dart';
|
export './rich_text_builder_theme_extension.dart';
|
||||||
export './text_input_theme_extension.dart';
|
export './text_input_theme_extension.dart';
|
||||||
export './top_app_bar_extension.dart';
|
export 'top_bar_theme_extension.dart';
|
||||||
|
@ -17,18 +17,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||||
|
|
||||||
abstract class TopAppBarThemeExtension
|
abstract class TopBarThemeExtension
|
||||||
extends ThemeExtension<TopAppBarThemeExtension> {
|
extends ThemeExtension<TopBarThemeExtension> {
|
||||||
const TopAppBarThemeExtension({
|
const TopBarThemeExtension({
|
||||||
this.iconTheme,
|
this.iconTheme,
|
||||||
this.backgroundColors,
|
this.backgroundColors,
|
||||||
this.expandedDividerStyle,
|
this.secondaryColor,
|
||||||
this.titleStyle,
|
this.titleStyle,
|
||||||
|
this.subTitleStyle,
|
||||||
});
|
});
|
||||||
|
|
||||||
final MultiColor? backgroundColors;
|
final MultiColor? backgroundColors;
|
||||||
final IconThemeData? iconTheme;
|
final IconThemeData? iconTheme;
|
||||||
final Color? expandedDividerStyle;
|
final Color? secondaryColor;
|
||||||
|
|
||||||
final TextStyle? titleStyle;
|
final TextStyle? titleStyle;
|
||||||
|
final TextStyle? subTitleStyle;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user