mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-06 08:15:26 -04:00
lint work
This commit is contained in:
parent
6e8725f569
commit
fe9d9f8aca
8 changed files with 129 additions and 117 deletions
|
@ -1,14 +1,15 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
T jsonDecodeBytes<T>(
|
||||
T Function(Map<String, dynamic>) fromJson, Uint8List data) => fromJson(jsonDecode(utf8.decode(data)));
|
||||
T jsonDecodeBytes<T>(T Function(dynamic) fromJson, Uint8List data) =>
|
||||
fromJson(jsonDecode(utf8.decode(data)));
|
||||
|
||||
Uint8List jsonEncodeBytes(Object? object,
|
||||
{Object? Function(Object?)? toEncodable}) => Uint8List.fromList(
|
||||
utf8.encode(jsonEncode(object, toEncodable: toEncodable)));
|
||||
{Object? Function(Object?)? toEncodable}) =>
|
||||
Uint8List.fromList(
|
||||
utf8.encode(jsonEncode(object, toEncodable: toEncodable)));
|
||||
|
||||
Future<Uint8List> jsonUpdateBytes<T>(T Function(Map<String, dynamic>) fromJson,
|
||||
Future<Uint8List> jsonUpdateBytes<T>(T Function(dynamic) fromJson,
|
||||
Uint8List oldBytes, Future<T> Function(T) update) async {
|
||||
final oldObj = fromJson(jsonDecode(utf8.decode(oldBytes)));
|
||||
final newObj = await update(oldObj);
|
||||
|
@ -16,7 +17,9 @@ Future<Uint8List> jsonUpdateBytes<T>(T Function(Map<String, dynamic>) fromJson,
|
|||
}
|
||||
|
||||
Future<Uint8List> Function(Uint8List) jsonUpdate<T>(
|
||||
T Function(Map<String, dynamic>) fromJson, Future<T> Function(T) update) => (oldBytes) => jsonUpdateBytes(fromJson, oldBytes, update);
|
||||
T Function(dynamic) fromJson, Future<T> Function(T) update) =>
|
||||
(oldBytes) => jsonUpdateBytes(fromJson, oldBytes, update);
|
||||
|
||||
T Function(Object?) genericFromJson<T>(
|
||||
T Function(Map<String, dynamic>) fromJsonMap) => (json) => fromJsonMap(json as Map<String, dynamic>);
|
||||
T Function(Map<String, dynamic>) fromJsonMap) =>
|
||||
(json) => fromJsonMap(json! as Map<String, dynamic>);
|
||||
|
|
|
@ -3,19 +3,20 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
|
||||
extension BorderExt on Widget {
|
||||
Container debugBorder() => DecoratedBox(
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.redAccent)),
|
||||
child: this);
|
||||
DecoratedBox debugBorder() => DecoratedBox(
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.redAccent)),
|
||||
child: this);
|
||||
}
|
||||
|
||||
extension ModalProgressExt on Widget {
|
||||
BlurryModalProgressHUD withModalHUD(BuildContext context, bool isLoading) => BlurryModalProgressHUD(
|
||||
inAsyncCall: isLoading,
|
||||
blurEffectIntensity: 4,
|
||||
progressIndicator: SpinKitFoldingCube(
|
||||
color: Theme.of(context).highlightColor,
|
||||
size: 90,
|
||||
),
|
||||
color: Theme.of(context).shadowColor,
|
||||
child: this);
|
||||
BlurryModalProgressHUD withModalHUD(BuildContext context, bool isLoading) =>
|
||||
BlurryModalProgressHUD(
|
||||
inAsyncCall: isLoading,
|
||||
blurEffectIntensity: 4,
|
||||
progressIndicator: SpinKitFoldingCube(
|
||||
color: Theme.of(context).highlightColor,
|
||||
size: 90,
|
||||
),
|
||||
color: Theme.of(context).shadowColor,
|
||||
child: this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue