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
import 'package:flutter/widgets.dart'; | |
class FormData<FormDataType> { | |
FormDataType data; | |
final List<FormEntry> _fields = <FormEntry>[]; | |
FormData({@required this.data}); | |
FormEntry add<FieldType>( | |
FieldType value, { |
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
class SomeForm extends FormData<SomeObj> { | |
FormField<Duration> field1; | |
FormField<int> field2; | |
* * * | |
DocketForm({@required SomeObj obj}) : super(data: obj) { | |
contact = add( | |
data.field1, | |
onSaved: (v) => data.copyWith(field1: v), | |
validator: (v) => v.isNullOrSpace ? 'Invalid field1 value' : null, | |
); |
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
import 'package:auto_route/auto_route.dart'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/widgets.dart'; | |
extension BlocLifecycleEx on BuildContext { | |
T bloc<T extends Cubit<Object>>() => BlocLifecycle.of<T>(this); | |
} |
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
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:sentry_flutter/sentry_flutter.dart'; | |
Future<void> main() async { | |
runZonedGuarded(() async { | |
await SentryFlutter.init( | |
(options) { | |
options.dsn = 'https://***@***.ingest.sentry.io/***'; |
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
Future<void> save<T>(String type, int id, String field, T? value) async { | |
if (value == null) { | |
await customStatement( | |
'DELETE FROM cache' | |
' WHERE id_type=\'$type\'' | |
' AND id_object=$id' | |
' AND field=\'$field\'', | |
); | |
} else { | |
String v; |
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
import 'package:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:pager/pager.dart'; | |
typedef BlocPagerCondition<State extends Object> = bool Function(State state); | |
class BlocPager<State extends Object> extends StatelessWidget { | |
final IStateObservable<State> bloc; | |
final PagerWidgetBuilder<State> builder; | |
final BlocPagerCondition<State>? buildWhen; |
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
import 'package:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
typedef BlocBuilderCondition<State extends Object> = bool Function(State state); | |
typedef BlocBuilderConverter<State extends Object, Result extends Object?> = Result Function(State state); | |
typedef BlocBuilderBuilder<Result extends Object?> = Widget Function(BuildContext context, Result result); | |
class BlocBuilder<State extends Object, Result extends Object> extends StatelessWidget { | |
final bool animate; |
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
import 'package:bloc/bloc.dart'; | |
extension IStateObservableEx<State extends Object?> on IStateObservable<State> { | |
StateObservable<SubState> whereState<SubState extends State>() => StateObservable<SubState>( | |
(state is SubState ? state : null) as SubState, | |
stream.whereState<SubState>(), | |
); | |
} | |
class StateObservable<State extends Object?> { |
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
typedef StateBuilderCondition<State extends Object> = bool Function(State state); | |
typedef StateBuilderConverter<State extends Object, Result extends Object?> = Result Function(State state); | |
typedef StateBuilderBuilder<Result extends Object?> = Widget Function(BuildContext context, Result result); | |
typedef StateBuilderOnWaiting = Widget Function(BuildContext context); | |
typedef StateBuilderOnError = Widget Function(BuildContext context, Object? error); | |
class StateBuilder { | |
@factory | |
static _StateBuilder<State> where<State extends Object>({ |
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
[ | |
{ | |
"key": "ctrl+shift+l", | |
"command": "editor.action.transformToLowercase" | |
}, | |
{ | |
"key": "ctrl+shift+u", | |
"command": "editor.action.transformToUppercase" | |
}, | |
{ |
OlderNewer