chore: fix and format using melos
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
@@ -25,7 +25,6 @@ class CounterBloc extends Bloc<CounterEvent, CounterState> {
|
||||
final CounterRepository counterRepository;
|
||||
|
||||
CounterBloc(this.counterRepository) : super(const CounterInitial()) {
|
||||
|
||||
on<CounterIncrement>((event, emit) {
|
||||
emit(CounterModified(counterRepository.increment(state.count)));
|
||||
});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
@@ -32,4 +32,3 @@ class CounterInitial extends CounterState {
|
||||
class CounterModified extends CounterState {
|
||||
const CounterModified(super.count);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,16 @@ class CounterBlocPage
|
||||
const CounterBlocPage({super.key});
|
||||
|
||||
@override
|
||||
CounterBloc create(BuildContext context) => CounterBloc(repo<CounterRepository>(context));
|
||||
CounterBloc create(BuildContext context) =>
|
||||
CounterBloc(repo<CounterRepository>(context));
|
||||
|
||||
@override
|
||||
Widget onBuild(BuildContext context, CounterState state) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Counter with Bloc')),
|
||||
body: Center(child: Text('${state.count}', style: textTheme.headline2)),
|
||||
body:
|
||||
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
|
||||
floatingActionButton: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
|
||||
@@ -28,7 +28,8 @@ class CounterConsumerPage
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Counter with Consumer')),
|
||||
body: Center(child: Text('${state.count}', style: textTheme.headline2)),
|
||||
body:
|
||||
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
|
||||
floatingActionButton: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
@@ -19,19 +19,20 @@ import 'package:bloc_helper_example/counter/repository/counter_repository.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
|
||||
|
||||
class CounterCubitPage
|
||||
extends CubitScreen<CounterCubit, CounterState> {
|
||||
class CounterCubitPage extends CubitScreen<CounterCubit, CounterState> {
|
||||
const CounterCubitPage({super.key});
|
||||
|
||||
@override
|
||||
CounterCubit create(BuildContext context) => CounterCubit(repo<CounterRepository>(context));
|
||||
CounterCubit create(BuildContext context) =>
|
||||
CounterCubit(repo<CounterRepository>(context));
|
||||
|
||||
@override
|
||||
Widget onBuild(BuildContext context, CounterState state) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Counter with Cubit')),
|
||||
body: Center(child: Text('${state.count}', style: textTheme.headline2)),
|
||||
body:
|
||||
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
|
||||
floatingActionButton: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
@@ -53,4 +54,4 @@ class CounterCubitPage
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class CounterProviderPage
|
||||
appBar: AppBar(title: const Text('Counter with Provider')),
|
||||
body: Center(child: BlocBuilder<CounterBloc, CounterState>(
|
||||
builder: (context, state) {
|
||||
return Text('${state.count}', style: textTheme.headline2);
|
||||
return Text('${state.count}', style: textTheme.displayMedium);
|
||||
},
|
||||
)),
|
||||
floatingActionButton: Column(
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
@@ -32,4 +32,3 @@ class CounterInitial extends CounterState {
|
||||
class CounterModified extends CounterState {
|
||||
const CounterModified(super.count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// 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/>.
|
||||
|
||||
@@ -23,4 +23,4 @@ class CounterObserver extends BlocObserver {
|
||||
super.onChange(bloc, change);
|
||||
debugPrint('${bloc.runtimeType} $change');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ class MainPage extends StatelessWidget {
|
||||
onPressed: () => Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (context) {
|
||||
return BlocProvider<CounterCubit>(
|
||||
create: (context) => CounterCubit(context.read<CounterRepository>()),
|
||||
create: (context) =>
|
||||
CounterCubit(context.read<CounterRepository>()),
|
||||
child: const CounterConsumerPage(),
|
||||
);
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user