docs(ui_layout): add some documentation + readme

This commit is contained in:
Hugo Pointcheval 2023-04-13 22:54:26 +02:00
parent 56de994e67
commit 79c5aa7c76
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
9 changed files with 69 additions and 97 deletions

View File

@ -7,7 +7,7 @@
* 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,
* 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.
@ -16,12 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
# Flutter - Wyatt Ui Layout
# Wyatt UI Layout
<p align="left">
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
</a>
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a>
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
</p>
@ -31,19 +29,19 @@ Wyatt UI Layout is a Flutter package that provides pre-built layouts to make the
Structural layouts are used to structure the GUI, and there are currently four layouts provided by this package:
- #### TopAppBarLayout
* #### TopAppBarLayout
This layout is used to create a GUI with a classic app bar and a body.
- #### TopNavigationBarLayout
* #### TopNavigationBarLayout
This layout is used to create a GUI with an app bar that includes navigation options and a body.
- #### BottomNavigationBarLayout
* #### BottomNavigationBarLayout
This layout is used to create a GUI with a bottom bar that includes navigation options and a body.
- #### FrameLayout
* #### FrameLayout
This layout is used to create a GUI that includes a classic app bar, a bottom navigation bar, and a body.
@ -51,19 +49,6 @@ This layout is used to create a GUI that includes a classic app bar, a bottom na
Content layouts are used to display dynamic data and content within the GUI. Currently, there is only one content layout provided by this package:
- #### GridLayout
* #### GridLayout
This layout is used to display data and content in a grid layout.
### Installation
To use Wyatt UI Layout in your Flutter project, add the following dependency to your pubspec.yaml file:
```yaml
wyatt_ui_layout:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
path: packages/wyatt_ui_layout
```
That's it! You're now ready to use Wyatt UI Layout in your project.

View File

@ -1,19 +1,2 @@
# 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/>.
include: package:wyatt_analysis/analysis_options.flutter.yaml

View File

@ -18,7 +18,12 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// {@template grid_layout}
/// A concrete implementation of the [ContentLayout] abstract class for a layout
/// which defines a layout structure with a grid layout.
/// {@endtemplate}
class GridLayout extends ContentLayout {
/// {@macro grid_layout}
const GridLayout({
required this.children,
this.verticalGap = 30,
@ -26,8 +31,13 @@ class GridLayout extends ContentLayout {
super.key,
});
/// The children of the layout.
final List<Widget> children;
/// The vertical gap between the children.
final double verticalGap;
/// The horizontal gap between the children.
final double horizontalGap;
@override

View File

@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@ -14,28 +14,35 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// This file contains the [Layout] abstract class, which provides a base
/// for creating custom layout widgets in Flutter.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
/// {@template layout}
/// An abstract class that provides a base for creating custom layout widgets.
///
/// This class can be used as a base for creating custom layout widgets in
/// Flutter. It extends the [StatelessWidget] class and adds support for
/// providing a custom key. Custom layout widgets that extend this class should
/// override the [build] method to define the layout.
/// {@endtemplate}
abstract class Layout extends StatelessWidget {
/// Creates a new [Layout] instance.
///
/// [key] is an optional parameter that can be used to provide a custom key
/// for the widget.
/// {@macro layout}
const Layout({super.key});
}
/// {@template structural_layout}
/// An abstract class that provides a base for creating custom structural layout
/// widgets.
/// {@endtemplate}
abstract class StructuralLayout extends Layout {
/// {@macro structural_layout}
const StructuralLayout({super.key});
}
/// {@template content_layout}
/// An abstract class that provides a base for creating custom content layout
/// widgets.
/// {@endtemplate}
abstract class ContentLayout extends Layout {
/// {@macro content_layout}
const ContentLayout({super.key});
}

View File

@ -14,34 +14,27 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// This file contains the concrete class [BottomNavigationBarLayout].
///
/// The [BottomNavigationBarLayout] class is a concrete implementation of the
/// [Layout] abstract class, which defines a layout structure with a bottom
/// navigation bar component.
///
/// [BottomNavigationBarLayout] includes an optional
/// [BottomNavigationBarLayout.custom]
/// function for customizing the bottom navigation bar component.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// A concrete implementation of the [Layout] abstract class for a layout with
/// a bottom navigation bar component.
/// {@template bottom_navigation_bar_layout}
/// A concrete implementation of the [Layout] abstract class for a layout which
/// defines a layout structure with a bottom navigation bar component.
/// {@endtemplate}
class BottomNavigationBarLayout extends StructuralLayout {
/// Creates a [BottomNavigationBarLayout] instance.
///
/// [body] represents the main content of the layout.
/// [custom] is an optional function that can be used to customize
/// the bottom navigation bar component.
/// {@macro bottom_navigation_bar_layout}
const BottomNavigationBarLayout({
required this.body,
this.custom,
super.key,
});
/// The main content of the layout.
final Widget? body;
/// An optional function that can be used to customize the bottom navigation
/// bar component.
final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)?
custom;

View File

@ -18,6 +18,7 @@ import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// {@template frame_layout}
/// A layout that contains a top app bar, a body and a bottom navigation bar.
///
/// This layout consists of a [TopAppBarComponent] at the top of the screen,
@ -25,15 +26,9 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// You can customize the app bar and the bottom navigation bar by passing
/// a [customAppBar] and a [customBottomNavBar] functions that take
/// the corresponding components and return the customized ones.
/// {@endtemplate}
class FrameLayout extends StructuralLayout {
/// Creates a [FrameLayout] instance.
///
/// [body] represents the main content of the layout.
/// [customAppBar] is an optional function that can be used to customize
/// the top app bar component.
/// [customBottomNavBar] is an optional function that can be used to customize
/// the bottom navigation bar component.
/// [height] represents the height of the top app bar.
/// {@macro frame_layout}
const FrameLayout({
required this.body,
this.customAppBar,
@ -42,10 +37,17 @@ class FrameLayout extends StructuralLayout {
super.key,
});
/// An optional function that can be used to customize the top app bar
final TopAppBarComponent? Function(TopAppBarComponent?)? customAppBar;
/// An optional function that can be used to customize the bottom navigation
final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)?
customBottomNavBar;
/// The main content of the layout.
final Widget body;
/// The height of the top app bar.
final double height;
@override

View File

@ -14,16 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/// This file contains the abstract class [TopBarLayout] and two concrete
/// classes [TopAppBarLayout] and [TopNavigationBarLayout].
/// The [TopBarLayout] abstract class defines a layout structure with a top bar.
/// The [TopAppBarLayout] and [TopNavigationBarLayout] classes are concrete
/// implementations of the [TopBarLayout] class.
import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// {@template top_bar_layout}
/// An abstract class for creating layouts with a top bar component.
///
/// This class provides a base for creating layouts that include a top bar
@ -34,14 +29,10 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart';
/// given [BuildContext].
///
/// [T] represents the type of the top bar component.
/// {@endtemplate}
abstract class TopBarLayout<T extends TopBarComponent>
extends StructuralLayout {
/// Creates a [TopBarLayout] instance.
///
/// [body] represents the main content of the layout.
/// [custom] is an optional function that can be used to customize
/// the top bar component.
/// [height] represents the height of the top bar.
/// {@macro top_bar_layout}
const TopBarLayout({
required this.body,
this.custom,
@ -49,9 +40,15 @@ abstract class TopBarLayout<T extends TopBarComponent>
super.key,
});
/// The main content of the layout.
final Widget body;
/// An optional function that can be used to customize the top bar component.
/// The function takes the top bar component as an argument and returns
/// a customized top bar component.
final T? Function(T?)? custom;
/// The height of the top bar.
final double height;
/// Returns the top bar component for the given [BuildContext].

View File

@ -14,7 +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/>.
/// Wyatt Ui Layout
/// Wyatt UI Layout
library wyatt_ui_layout;
export 'src/src.dart';

View File

@ -3,27 +3,22 @@ description: Main layouts to help you build your application views.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_ui_layout
version: 0.0.1
publish_to: "none"
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
environment:
sdk: ">=2.17.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter: { sdk: flutter }
gap: ^2.0.1
wyatt_ui_components:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
path: packages/wyatt_ui_components
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_test: { sdk: flutter }
wyatt_analysis:
git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.1
path: packages/wyatt_analysis
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.4.1