diff --git a/lib/data/api/api_util.dart b/lib/data/api/api_util.dart index 0f5a916..61754b3 100644 --- a/lib/data/api/api_util.dart +++ b/lib/data/api/api_util.dart @@ -1,20 +1,19 @@ -import 'package:habr_flutter_clean_arch/data/api/request/get_day_body.dart'; -import 'package:habr_flutter_clean_arch/data/mapper/day_mapper.dart'; -import 'package:meta/meta.dart'; -import 'package:habr_flutter_clean_arch/data/api/service/sunrise_service.dart'; -import 'package:habr_flutter_clean_arch/domain/model/day.dart'; - -class ApiUtil { - final SunriseService _sunriseService; - - ApiUtil(this._sunriseService); - - Future getDay({ - @required double latitude, - @required double longitude, - }) async { - final body = GetDayBody(latitude: latitude, longitude: longitude); - final result = await _sunriseService.getDay(body); - return DayMapper.fromApi(result); - } -} +import 'package:habr_flutter_clean_arch/data/api/request/get_day_body.dart'; +import 'package:habr_flutter_clean_arch/data/mapper/day_mapper.dart'; +import 'package:habr_flutter_clean_arch/data/api/service/sunrise_service.dart'; +import 'package:habr_flutter_clean_arch/domain/model/day.dart'; + +class ApiUtil { + final SunriseService _sunriseService; + + ApiUtil(this._sunriseService); + + Future getDay({ + required double latitude, + required double longitude, + }) async { + final body = GetDayBody(latitude: latitude, longitude: longitude); + final result = await _sunriseService.getDay(body); + return DayMapper.fromApi(result); + } +} \ No newline at end of file diff --git a/lib/data/api/model/api_day.dart b/lib/data/api/model/api_day.dart index b1749b4..de3606a 100644 --- a/lib/data/api/model/api_day.dart +++ b/lib/data/api/model/api_day.dart @@ -1,12 +1,12 @@ -class ApiDay { - final String sunrise; - final String sunset; - final String solarNoon; - final num dayLength; - - ApiDay.fromApi(Map map) - : sunrise = map['results']['sunrise'], - sunset = map['results']['sunset'], - solarNoon = map['results']['solar_noon'], - dayLength = map['results']['day_length']; -} +class ApiDay { + final String sunrise; + final String sunset; + final String solarNoon; + final num dayLength; + + ApiDay.fromApi(Map map) + : sunrise = map['results']['sunrise'], + sunset = map['results']['sunset'], + solarNoon = map['results']['solar_noon'], + dayLength = map['results']['day_length']; +} \ No newline at end of file diff --git a/lib/data/api/request/get_day_body.dart b/lib/data/api/request/get_day_body.dart index 7465342..a33c140 100644 --- a/lib/data/api/request/get_day_body.dart +++ b/lib/data/api/request/get_day_body.dart @@ -1,19 +1,17 @@ -import 'package:meta/meta.dart'; - -class GetDayBody { - final double latitude; - final double longitude; - - GetDayBody({ - @required this.latitude, - @required this.longitude, - }); - - Map toApi() { - return { - 'lat': latitude, - 'lng': longitude, - 'formatted': 0, - }; - } -} +class GetDayBody { + final double latitude; + final double longitude; + + GetDayBody({ + required this.latitude, + required this.longitude, + }); + + Map toApi() { + return { + 'lat': latitude, + 'lng': longitude, + 'formatted': 0, + }; + } +} \ No newline at end of file diff --git a/lib/data/api/service/sunrise_service.dart b/lib/data/api/service/sunrise_service.dart index 42e7a5c..c654703 100644 --- a/lib/data/api/service/sunrise_service.dart +++ b/lib/data/api/service/sunrise_service.dart @@ -1,19 +1,19 @@ -import 'package:dio/dio.dart'; -import 'package:habr_flutter_clean_arch/data/api/model/api_day.dart'; -import 'package:habr_flutter_clean_arch/data/api/request/get_day_body.dart'; - -class SunriseService { - static const _BASE_URL = 'https://api.sunrise-sunset.org'; - - final Dio _dio = Dio( - BaseOptions(baseUrl: _BASE_URL), - ); - - Future getDay(GetDayBody body) async { - final response = await _dio.get( - '/json', - queryParameters: body.toApi(), - ); - return ApiDay.fromApi(response.data); - } -} +import 'package:dio/dio.dart'; +import 'package:habr_flutter_clean_arch/data/api/model/api_day.dart'; +import 'package:habr_flutter_clean_arch/data/api/request/get_day_body.dart'; + +class SunriseService { + static const _base_url = 'https://api.sunrise-sunset.org'; + + final Dio _dio = Dio( + BaseOptions(baseUrl: _base_url), + ); + + Future getDay(GetDayBody body) async { + final response = await _dio.get( + '/json', + queryParameters: body.toApi(), + ); + return ApiDay.fromApi(response.data); + } +} \ No newline at end of file diff --git a/lib/data/mapper/day_mapper.dart b/lib/data/mapper/day_mapper.dart index c7ff4d9..472aca2 100644 --- a/lib/data/mapper/day_mapper.dart +++ b/lib/data/mapper/day_mapper.dart @@ -1,13 +1,13 @@ -import 'package:habr_flutter_clean_arch/data/api/model/api_day.dart'; -import 'package:habr_flutter_clean_arch/domain/model/day.dart'; - -class DayMapper { - static Day fromApi(ApiDay day) { - return Day( - sunrise: DateTime.tryParse(day.sunrise), - sunset: DateTime.tryParse(day.sunset), - solarNoon: DateTime.tryParse(day.solarNoon), - dayLength: day.dayLength.toInt(), - ); - } -} +import 'package:habr_flutter_clean_arch/data/api/model/api_day.dart'; +import 'package:habr_flutter_clean_arch/domain/model/day.dart'; + +class DayMapper { + static Day fromApi(ApiDay day) { + return Day( + sunrise: DateTime.tryParse(day.sunrise)!, + sunset: DateTime.tryParse(day.sunset)!, + solarNoon: DateTime.tryParse(day.solarNoon)!, + dayLength: day.dayLength.toInt(), + ); + } +} \ No newline at end of file diff --git a/lib/data/repository/day_data_repository.dart b/lib/data/repository/day_data_repository.dart index c693645..7a4f2b0 100644 --- a/lib/data/repository/day_data_repository.dart +++ b/lib/data/repository/day_data_repository.dart @@ -1,14 +1,16 @@ -import 'package:habr_flutter_clean_arch/data/api/api_util.dart'; -import 'package:habr_flutter_clean_arch/domain/model/day.dart'; -import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; - -class DayDataRepository extends DayRepository { - final ApiUtil _apiUtil; - - DayDataRepository(this._apiUtil); - - @override - Future getDay({double latitude, double longitude}) { - return _apiUtil.getDay(latitude: latitude, longitude: longitude); - } -} +import 'package:habr_flutter_clean_arch/data/api/api_util.dart'; +import 'package:habr_flutter_clean_arch/domain/model/day.dart'; +import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; + +class DayDataRepository extends DayRepository { + final ApiUtil _apiUtil; + + DayDataRepository(this._apiUtil); + + @override + Future getDay({ required double latitude, required double longitude}) { + + return _apiUtil.getDay(latitude: latitude, longitude: longitude); + + } +} \ No newline at end of file diff --git a/lib/domain/model/day.dart b/lib/domain/model/day.dart index e124524..d0dbb90 100644 --- a/lib/domain/model/day.dart +++ b/lib/domain/model/day.dart @@ -1,15 +1,14 @@ -import 'package:meta/meta.dart'; - -class Day { - final DateTime sunrise; - final DateTime sunset; - final DateTime solarNoon; - final int dayLength; - - Day({ - @required this.sunrise, - @required this.sunset, - @required this.solarNoon, - @required this.dayLength, - }); -} + +class Day { + final DateTime sunrise; + final DateTime sunset; + final DateTime solarNoon; + final int dayLength; + + Day({ + required this.sunrise, + required this.sunset, + required this.solarNoon, + required this.dayLength, + }); +} \ No newline at end of file diff --git a/lib/domain/repository/day_repository.dart b/lib/domain/repository/day_repository.dart index ee62313..4ea921c 100644 --- a/lib/domain/repository/day_repository.dart +++ b/lib/domain/repository/day_repository.dart @@ -1,9 +1,8 @@ -import 'package:meta/meta.dart'; -import 'package:habr_flutter_clean_arch/domain/model/day.dart'; - -abstract class DayRepository { - Future getDay({ - @required double latitude, - @required double longitude, - }); -} +import 'package:habr_flutter_clean_arch/domain/model/day.dart'; + +abstract class DayRepository { + Future getDay({ + required double latitude, + required double longitude, + }); +} \ No newline at end of file diff --git a/lib/domain/state/home/home_state.dart b/lib/domain/state/home/home_state.dart index a9e8e0e..0a102db 100644 --- a/lib/domain/state/home/home_state.dart +++ b/lib/domain/state/home/home_state.dart @@ -1,31 +1,34 @@ -import 'package:mobx/mobx.dart'; -import 'package:meta/meta.dart'; -import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; -import 'package:habr_flutter_clean_arch/domain/model/day.dart'; - -part 'home_state.g.dart'; - -class HomeState = HomeStateBase with _$HomeState; - -abstract class HomeStateBase with Store { - HomeStateBase(this._dayRepository); - - final DayRepository _dayRepository; - - @observable - Day day; - - @observable - bool isLoading = false; - - @action - Future getDay({ - @required double latitude, - @required double longitude, - }) async { - isLoading = true; - final data = await _dayRepository.getDay(latitude: latitude, longitude: longitude); - day = data; - isLoading = false; - } -} +import 'package:mobx/mobx.dart'; +import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; +import 'package:habr_flutter_clean_arch/domain/model/day.dart'; + +part 'home_state.g.dart'; + +class HomeState = HomeStateBase with _$HomeState; + +abstract class HomeStateBase with Store { + final DayRepository _dayRepository; + + HomeStateBase(this._dayRepository); + + @observable + late Day day; + + @observable + bool isLoading = false; + @observable + bool isGeted = false; + + + @action + Future getDay({ + required double latitude, + required double longitude, + }) async { + isLoading = true; + final data = await _dayRepository.getDay(latitude: latitude, longitude: longitude); + day = data; + isGeted = true; + isLoading = false; + } +} \ No newline at end of file diff --git a/lib/domain/state/home/home_state.g.dart b/lib/domain/state/home/home_state.g.dart index ae445d3..4db7b70 100644 --- a/lib/domain/state/home/home_state.g.dart +++ b/lib/domain/state/home/home_state.g.dart @@ -6,10 +6,10 @@ part of 'home_state.dart'; // StoreGenerator // ************************************************************************** -// ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic +// ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, no_leading_underscores_for_local_identifiers mixin _$HomeState on HomeStateBase, Store { - final _$dayAtom = Atom(name: 'HomeStateBase.day'); + late final _$dayAtom = Atom(name: 'HomeStateBase.day', context: context); @override Day get day { @@ -17,14 +17,18 @@ mixin _$HomeState on HomeStateBase, Store { return super.day; } + bool _dayIsInitialized = false; + @override set day(Day value) { - _$dayAtom.reportWrite(value, super.day, () { + _$dayAtom.reportWrite(value, _dayIsInitialized ? super.day : null, () { super.day = value; + _dayIsInitialized = true; }); } - final _$isLoadingAtom = Atom(name: 'HomeStateBase.isLoading'); + late final _$isLoadingAtom = + Atom(name: 'HomeStateBase.isLoading', context: context); @override bool get isLoading { @@ -39,10 +43,26 @@ mixin _$HomeState on HomeStateBase, Store { }); } - final _$getDayAsyncAction = AsyncAction('HomeStateBase.getDay'); + late final _$getedAtom = Atom(name: 'HomeStateBase.geted', context: context); + + @override + bool get isGeted { + _$getedAtom.reportRead(); + return super.isGeted; + } + + @override + set isGeted(bool value) { + _$getedAtom.reportWrite(value, super.isGeted, () { + super.isGeted = value; + }); + } + + late final _$getDayAsyncAction = + AsyncAction('HomeStateBase.getDay', context: context); @override - Future getDay({@required double latitude, @required double longitude}) { + Future getDay({required double latitude, required double longitude}) { return _$getDayAsyncAction .run(() => super.getDay(latitude: latitude, longitude: longitude)); } @@ -51,7 +71,8 @@ mixin _$HomeState on HomeStateBase, Store { String toString() { return ''' day: ${day}, -isLoading: ${isLoading} +isLoading: ${isLoading}, +geted: ${isGeted} '''; } } diff --git a/lib/internal/application.dart b/lib/internal/application.dart index d269aac..2bd1dda 100644 --- a/lib/internal/application.dart +++ b/lib/internal/application.dart @@ -1,16 +1,16 @@ -import 'package:flutter/material.dart'; -import 'package:habr_flutter_clean_arch/presentation/home.dart'; - -class Application extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - primarySwatch: Colors.blue, - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - home: Home(), - ); - } -} +import 'package:flutter/material.dart'; +import 'package:habr_flutter_clean_arch/presentation/home.dart'; + +class Application extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + visualDensity: VisualDensity.adaptivePlatformDensity, + ), + home: const Home(), + ); + } +} \ No newline at end of file diff --git a/lib/internal/dependencies/api_module.dart b/lib/internal/dependencies/api_module.dart index 1397f8c..287347c 100644 --- a/lib/internal/dependencies/api_module.dart +++ b/lib/internal/dependencies/api_module.dart @@ -1,13 +1,10 @@ -import 'package:habr_flutter_clean_arch/data/api/api_util.dart'; -import 'package:habr_flutter_clean_arch/data/api/service/sunrise_service.dart'; - -class ApiModule { - static ApiUtil _apiUtil; - - static ApiUtil apiUtil() { - if (_apiUtil == null) { - _apiUtil = ApiUtil(SunriseService()); - } - return _apiUtil; - } -} +import 'package:habr_flutter_clean_arch/data/api/api_util.dart'; +import 'package:habr_flutter_clean_arch/data/api/service/sunrise_service.dart'; + +class ApiModule { + static final ApiUtil _apiUtil = ApiUtil(SunriseService()); + + static ApiUtil apiUtil() { + return _apiUtil; + } +} \ No newline at end of file diff --git a/lib/internal/dependencies/home_module.dart b/lib/internal/dependencies/home_module.dart index cc1c7e6..aabcaa4 100644 --- a/lib/internal/dependencies/home_module.dart +++ b/lib/internal/dependencies/home_module.dart @@ -1,10 +1,9 @@ -import 'package:habr_flutter_clean_arch/domain/state/home/home_state.dart'; -import 'package:habr_flutter_clean_arch/internal/dependencies/repository_module.dart'; - -class HomeModule { - static HomeState homeState() { - return HomeState( - RepositoryModule.dayRepository(), - ); - } -} +import 'package:habr_flutter_clean_arch/domain/state/home/home_state.dart'; +import 'package:habr_flutter_clean_arch/internal/dependencies/repository_module.dart'; +class HomeModule { + static HomeState homeState() { + return HomeState( + RepositoryModule.dayRepository(), + ); + } +} \ No newline at end of file diff --git a/lib/internal/dependencies/repository_module.dart b/lib/internal/dependencies/repository_module.dart index e677a6c..8717c7c 100644 --- a/lib/internal/dependencies/repository_module.dart +++ b/lib/internal/dependencies/repository_module.dart @@ -1,17 +1,12 @@ -import 'package:habr_flutter_clean_arch/data/repository/day_data_repository.dart'; -import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; - -import 'api_module.dart'; - -class RepositoryModule { - static DayRepository _dayRepository; - - static DayRepository dayRepository() { - if (_dayRepository == null) { - _dayRepository = DayDataRepository( - ApiModule.apiUtil(), - ); - } - return _dayRepository; - } -} +import 'package:habr_flutter_clean_arch/data/repository/day_data_repository.dart'; +import 'package:habr_flutter_clean_arch/domain/repository/day_repository.dart'; + +import 'api_module.dart'; + +class RepositoryModule { + static final DayRepository _dayRepository = DayDataRepository(ApiModule.apiUtil()); + + static DayRepository dayRepository() { + return _dayRepository; + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 13b3c66..86b4159 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ -import 'package:flutter/material.dart'; - -import 'internal/application.dart'; - -void main() { - runApp(Application()); -} +import 'package:flutter/material.dart'; +import 'internal/application.dart'; + +void main() { + runApp(Application()); +} diff --git a/lib/presentation/home.dart b/lib/presentation/home.dart index f167a2e..4122fe1 100644 --- a/lib/presentation/home.dart +++ b/lib/presentation/home.dart @@ -1,105 +1,109 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:habr_flutter_clean_arch/domain/state/home/home_state.dart'; -import 'package:habr_flutter_clean_arch/internal/dependencies/home_module.dart'; - -class Home extends StatefulWidget { - @override - _HomeState createState() => _HomeState(); -} - -class _HomeState extends State { - final _latController = TextEditingController(); - final _lngController = TextEditingController(); - - HomeState _homeState; - - @override - void initState() { - super.initState(); - _homeState = HomeModule.homeState(); - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: FocusScope.of(context).unfocus, - child: Scaffold( - body: _getBody(), - ), - ); - } - - Widget _getBody() { - return SafeArea( - child: Padding( - padding: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _getRowInput(), - SizedBox(height: 20), - RaisedButton( - child: Text('Получить'), - onPressed: _getDay, - ), - SizedBox(height: 20), - _getDayInfo(), - ], - ), - ), - ); - } - - Widget _getRowInput() { - return Row( - children: [ - Expanded( - child: TextField( - controller: _latController, - autofocus: false, - keyboardType: TextInputType.numberWithOptions(decimal: true, signed: true), - decoration: InputDecoration(hintText: 'Широта'), - ), - ), - SizedBox(width: 20), - Expanded( - child: TextField( - controller: _lngController, - autofocus: false, - keyboardType: TextInputType.numberWithOptions(decimal: true, signed: true), - decoration: InputDecoration(hintText: 'Долгота'), - ), - ), - ], - ); - } - - Widget _getDayInfo() { - return Observer( - builder: (_) { - if (_homeState.isLoading) - return Center( - child: CircularProgressIndicator(), - ); - if (_homeState.day == null) return Container(); - return Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text('Восход: ${_homeState.day.sunrise.toLocal()}'), - Text('Заход: ${_homeState.day.sunset.toLocal()}'), - Text('Полдень: ${_homeState.day.solarNoon.toLocal()}'), - Text('Продолжительность: ${Duration(seconds: _homeState.day.dayLength)}'), - ], - ); - }, - ); - } - - void _getDay() { - // здесь получаем данные - final lat = double.tryParse(_latController.text); - final lng = double.tryParse(_lngController.text); - _homeState.getDay(latitude: lat, longitude: lng); - } -} +import 'package:flutter/material.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:habr_flutter_clean_arch/domain/state/home/home_state.dart'; +import 'package:habr_flutter_clean_arch/internal/dependencies/home_module.dart'; + +class Home extends StatefulWidget { + const Home({super.key}); + + @override + _HomeState createState() => _HomeState(); +} + +class _HomeState extends State { + final _latController = TextEditingController(); + final _lngController = TextEditingController(); + + late HomeState _homeState; + + @override + void initState() { + super.initState(); + _homeState = HomeModule.homeState(); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: FocusScope.of(context).unfocus, + child: Scaffold( + body: _getBody(), + ), + ); + } + + Widget _getBody() { + return SafeArea( + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _getRowInput(), + SizedBox(height: 20), + TextButton( + child: Text('Получить'), + onPressed: _getDay, + ), + SizedBox(height: 20), + _getDayInfo(), + ], + ), + ), + ); + } + + Widget _getRowInput() { + return Row( + children: [ + Expanded( + child: TextField( + controller: _latController, + keyboardType: TextInputType.numberWithOptions(decimal: true, signed: true), + decoration: InputDecoration(hintText: 'Широта'), + ), + ), + SizedBox(width: 20), + Expanded( + child: TextField( + controller: _lngController, + keyboardType: TextInputType.numberWithOptions(decimal: true, signed: true), + decoration: InputDecoration(hintText: 'Долгота'), + ), + ), + ], + ); + } + + Widget _getDayInfo() { + return Observer( + builder: (_) { + if (_homeState.isLoading) + return Center( + child: CircularProgressIndicator(), + ); + if (_homeState.isGeted == false) return Container(); + else { + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text('Восход: ${_homeState.day.sunrise.toLocal()}'), + Text('Заход: ${_homeState.day.sunset.toLocal()}'), + Text('Полдень: ${_homeState.day.solarNoon.toLocal()}'), + Text('Продолжительность: ${Duration(seconds: _homeState.day.dayLength)}'), + ], + ); + } + }, + ); + } + + void _getDay() { + // здесь получаем данные + + final lat = double.tryParse(_latController.text); + final lng = double.tryParse(_lngController.text); + _homeState.getDay(latitude: lat!, longitude: lng!); + + } +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 210dcd8..4e1cdc6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,390 +5,436 @@ packages: dependency: transitive description: name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "64.0.0" analyzer: dependency: transitive description: name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted - version: "0.39.14" + version: "6.2.0" args: dependency: transitive description: name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "1.6.0" + version: "2.4.2" async: dependency: transitive description: name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.1" build: dependency: transitive description: name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "2.4.1" build_config: dependency: transitive description: name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 url: "https://pub.dev" source: hosted - version: "0.4.2" + version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" url: "https://pub.dev" source: hosted - version: "1.3.11" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" url: "https://pub.dev" source: hosted - version: "1.10.1" + version: "2.4.8" build_runner_core: dependency: transitive description: name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.3.0" built_collection: dependency: transitive description: name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" url: "https://pub.dev" source: hosted - version: "4.3.2" + version: "5.1.1" built_value: dependency: transitive description: name: built_value + sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e url: "https://pub.dev" source: hosted - version: "7.1.0" + version: "8.9.1" characters: dependency: transitive description: name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.0.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dev" - source: hosted - version: "1.1.3" + version: "1.3.0" checked_yaml: dependency: transitive description: name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "1.0.2" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dev" - source: hosted - version: "0.1.4" + version: "2.0.3" clock: dependency: transitive description: name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.1" code_builder: dependency: transitive description: name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 url: "https://pub.dev" source: hosted - version: "3.5.0" + version: "4.10.0" collection: dependency: transitive description: name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.14.13" + version: "1.18.0" convert: dependency: transitive description: name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.1.1" crypto: dependency: transitive description: name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "2.1.5" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dev" - source: hosted - version: "0.16.2" + version: "3.0.3" cupertino_icons: dependency: "direct main" description: name: cupertino_icons + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "1.0.6" dart_style: dependency: transitive description: name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" url: "https://pub.dev" source: hosted - version: "1.3.6" + version: "2.3.6" dio: dependency: "direct main" description: name: dio + sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8" url: "https://pub.dev" source: hosted - version: "3.0.10" + version: "5.4.1" fake_async: dependency: transitive description: name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" fixnum: dependency: transitive description: name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "0.10.11" + version: "1.1.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" flutter_mobx: dependency: "direct main" description: name: flutter_mobx + sha256: "4a5d062ff85ed3759f4aac6410ff0ffae32e324b2e71ca722ae1b37b32e865f4" url: "https://pub.dev" source: hosted - version: "1.1.0+2" + version: "2.2.0+2" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" - glob: + frontend_server_client: dependency: transitive description: - name: glob + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "1.2.0" - graphs: + version: "3.2.0" + glob: dependency: transitive description: - name: graphs + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "0.2.0" - html: + version: "2.1.2" + graphs: dependency: transitive description: - name: html + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted - version: "0.14.0+4" + version: "2.3.1" http_multi_server: dependency: transitive description: name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "3.2.1" http_parser: dependency: transitive description: name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "4.0.2" io: dependency: transitive description: name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" url: "https://pub.dev" source: hosted - version: "0.3.4" + version: "1.0.4" js: dependency: transitive description: name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.6.2" + version: "0.7.1" json_annotation: dependency: transitive description: name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "2.1.1" logging: dependency: transitive description: name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "0.11.4" + version: "1.2.0" matcher: dependency: transitive description: name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.12.8" + version: "0.5.0" meta: dependency: transitive description: name: meta + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.1.8" + version: "1.10.0" mime: dependency: transitive description: name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "0.9.7" + version: "1.0.5" mobx: dependency: "direct main" description: name: mobx + sha256: "74ee54012dc7c1b3276eaa960a600a7418ef5f9997565deb8fca1fd88fb36b78" url: "https://pub.dev" source: hosted - version: "1.2.1+3" + version: "2.3.0+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen + sha256: b26c7f9c20b38f0ea572c1ed3f29d8e027cb265538bbd1aed3ec198642cfca42 url: "https://pub.dev" source: hosted - version: "1.1.1+1" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dev" - source: hosted - version: "1.1.1" - node_io: + version: "2.6.0+1" + nested: dependency: transitive description: - name: node_io + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.0.0" package_config: dependency: transitive description: name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "2.1.0" path: dependency: transitive description: name: path + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.7.0" - pedantic: + version: "1.8.3" + pool: dependency: transitive description: - name: pedantic + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" url: "https://pub.dev" source: hosted - version: "1.9.0" - pool: + version: "1.5.1" + provider: dependency: transitive description: - name: pool + name: provider + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "6.1.2" pub_semver: dependency: transitive description: name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "1.4.4" + version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 url: "https://pub.dev" source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dev" - source: hosted - version: "2.1.3" + version: "1.2.3" shelf: dependency: transitive description: name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "0.7.9" + version: "1.4.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "0.2.3" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -398,99 +444,122 @@ packages: dependency: transitive description: name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "0.9.7+1" + version: "1.5.0" source_span: dependency: transitive description: name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.9.5" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.2" stream_transform: dependency: transitive description: name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.2.17" + version: "0.6.1" timing: dependency: transitive description: name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" url: "https://pub.dev" source: hosted - version: "0.1.1+2" + version: "1.0.1" typed_data: dependency: transitive description: name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "2.1.4" watcher: dependency: transitive description: name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.9.7+15" + version: "0.3.0" web_socket_channel: dependency: transitive description: name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "2.4.0" yaml: dependency: transitive description: name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "3.1.2" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" + dart: ">=3.2.6 <4.0.0" + flutter: ">=1.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 875b04e..cb6f14a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,56 +1,95 @@ -name: habr_flutter_clean_arch -description: A new Flutter project. - -publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.0+1 - -environment: - sdk: ">=2.7.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - cupertino_icons: ^0.1.3 - dio: ^3.0.10 - mobx: ^1.2.1+3 - flutter_mobx: ^1.1.0+2 - -dev_dependencies: - flutter_test: - sdk: flutter - mobx_codegen: ^1.1.1+1 - build_runner: ^1.10.0 - -flutter: - uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages +name: front +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.2.6 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + mobx: + flutter_mobx: + dio: + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + mobx_codegen: + build_runner: + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages