master #81

Closed
malo wants to merge 322 commits from master into feat/bloc_layout/new-package
3 changed files with 37 additions and 12 deletions
Showing only changes of commit efa7ca09dd - Show all commits

View File

@ -28,17 +28,17 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) => ComponentTheme( Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components, componentThemeWidget: AppThemeComponent.components,
child: MaterialApp( child: MaterialApp(
title: 'Wyatt Ui Components Example', title: 'Wyatt Ui Components Example',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
),
home: const Scaffold(
body: Home(),
),
), ),
home: const Scaffold( );
body: Home(),
),
),
);
} }
class Home extends StatelessWidget { class Home extends StatelessWidget {
@ -48,14 +48,15 @@ class Home extends StatelessWidget {
Widget build(BuildContext context) => Scaffold( Widget build(BuildContext context) => Scaffold(
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: const Size.fromHeight(60), preferredSize: const Size.fromHeight(60),
child: context.components.appBar?.copyWith.title('Example title') ?? child: context.components.appBar?.copyWith
.title('Example title'.wrap()) ??
const SizedBox.shrink(), const SizedBox.shrink(),
), ),
body: Column( body: Column(
children: [ children: [
Expanded( Expanded(
child: context.components.errorWidget child: context.components.errorWidget
?.copyWith(error: 'Example erreur') ?? ?.copyWith(error: 'Example erreur'.wrap()) ??
const SizedBox.shrink(), const SizedBox.shrink(),
), ),
const SizedBox( const SizedBox(

View File

@ -15,5 +15,6 @@
// 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 'extensions/build_context_extensions.dart'; export 'extensions/build_context_extensions.dart';
export 'extensions/string_extension.dart';
export 'mixins/copy_with_mixin.dart'; export 'mixins/copy_with_mixin.dart';
export 'utils/text_wrapper.dart'; export 'utils/text_wrapper.dart';

View File

@ -0,0 +1,23 @@
// 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/core/utils/text_wrapper.dart';
extension StringExtension on String? {
TextWrapper? wrap({TextStyle? style}) =>
this != null ? TextWrapper(this!, style: style) : null;
}