-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from Onix-Systems/dev
1.2.0+29
- Loading branch information
Showing
51 changed files
with
737 additions
and
589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
bricks/flutter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/app/constants.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Constants { | ||
const Constants._(); | ||
|
||
final class Constants { | ||
static const String filterParamAll = 'All'; | ||
|
||
const Constants._(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
...ks/flutter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/app/util/dimensions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{{^web_only}}import 'package:flutter_screenutil/flutter_screenutil.dart';{{/web_only}} | ||
{{#screen_util}}import 'package:flutter_screenutil/flutter_screenutil.dart';{{/screen_util}} | ||
|
||
class Dimensions { | ||
{{^web_only}}static final delimiterH10 = 10.h;{{/web_only}} | ||
{{#web_only}}static final delimiterH10 = 10.0;{{/web_only}} | ||
} | ||
final class Dimensions { | ||
{{#screen_util}} static final delimiterH10 = 10.h;{{/screen_util}} | ||
{{^screen_util}} static const delimiterH10 = 10.0;{{/screen_util}} | ||
|
||
const Dimensions._(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 10 additions & 45 deletions
55
...utter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/core/arch/bloc/base_bloc.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,17 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:{{project_name}}/core/arch/bloc/sr_mixin.dart'; | ||
import 'package:{{project_name}}/core/arch/domain/entity/failure/failure.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:{{project_name}}/core/arch/bloc/failure_stream_mixin.dart'; | ||
import 'package:{{project_name}}/core/arch/bloc/progress_stream_mixin.dart'; | ||
import 'package:{{project_name}}/core/arch/bloc/sr_mixin.dart'; | ||
|
||
abstract class BaseBloc<Event, State, SR> extends Bloc<Event, State> | ||
with SingleResultMixin<Event, State, SR> { | ||
@protected | ||
late StreamController<Failure> _errorStreamController; | ||
|
||
@protected | ||
late StreamController<bool> _progressStreamController; | ||
|
||
Stream<Failure> get failureStream => _errorStreamController.stream; | ||
|
||
Stream<bool> get progressStream => _progressStreamController.stream; | ||
|
||
BaseBloc(super.initialState) { | ||
_errorStreamController = StreamController<Failure>.broadcast(); | ||
_progressStreamController = StreamController<bool>.broadcast(); | ||
} | ||
|
||
void showProgress() { | ||
if (!_progressStreamController.isClosed) { | ||
_progressStreamController.add(true); | ||
} | ||
} | ||
|
||
Future<void> hideProgress() async { | ||
await Future<void>.delayed(const Duration(milliseconds: 50)); | ||
if (!_progressStreamController.isClosed) { | ||
_progressStreamController.add(false); | ||
} | ||
} | ||
|
||
void onFailure(Failure failure) { | ||
if (!_errorStreamController.isClosed) { | ||
_errorStreamController.add(failure); | ||
} | ||
} | ||
with | ||
SingleResultMixin<Event, State, SR>, | ||
ProgressStreamMixin, | ||
FailureStreamMixin { | ||
BaseBloc(super.initialState); | ||
|
||
void dispose() { | ||
if (!_errorStreamController.isClosed) { | ||
_errorStreamController.close(); | ||
} | ||
if (!_progressStreamController.isClosed) { | ||
_progressStreamController.close(); | ||
} | ||
closeProgressStream(); | ||
closeFailureStream(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.