mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 01:45:11 +00:00
refactor: Omit local types
This commit is contained in:
parent
e88afdd357
commit
ef5ea57c58
7 changed files with 10 additions and 9 deletions
|
@ -9,6 +9,7 @@ linter:
|
||||||
- prefer_final_in_for_each
|
- prefer_final_in_for_each
|
||||||
- sort_pub_dependencies
|
- sort_pub_dependencies
|
||||||
- require_trailing_commas
|
- require_trailing_commas
|
||||||
|
- omit_local_variable_types
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
errors:
|
errors:
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ChatEmojiPicker extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ThemeData theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
curve: FluffyThemes.animationCurve,
|
curve: FluffyThemes.animationCurve,
|
||||||
|
|
|
@ -28,8 +28,8 @@ class EventInfoDialog extends StatelessWidget {
|
||||||
});
|
});
|
||||||
|
|
||||||
String get prettyJson {
|
String get prettyJson {
|
||||||
const JsonDecoder decoder = JsonDecoder();
|
const decoder = JsonDecoder();
|
||||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
const encoder = JsonEncoder.withIndent(' ');
|
||||||
final object = decoder.convert(jsonEncode(event.toJson()));
|
final object = decoder.convert(jsonEncode(event.toJson()));
|
||||||
return encoder.convert(object);
|
return encoder.convert(object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class InputBar extends StatelessWidget {
|
||||||
}
|
}
|
||||||
final searchText =
|
final searchText =
|
||||||
controller!.text.substring(0, controller!.selection.baseOffset);
|
controller!.text.substring(0, controller!.selection.baseOffset);
|
||||||
final List<Map<String, String?>> ret = <Map<String, String?>>[];
|
final ret = <Map<String, String?>>[];
|
||||||
const maxResults = 30;
|
const maxResults = 30;
|
||||||
|
|
||||||
final commandMatch = RegExp(r'^/(\w*)$').firstMatch(searchText);
|
final commandMatch = RegExp(r'^/(\w*)$').firstMatch(searchText);
|
||||||
|
|
|
@ -64,7 +64,7 @@ class SendFileDialogState extends State<SendFileDialog> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var sendStr = L10n.of(context)!.sendFile;
|
var sendStr = L10n.of(context)!.sendFile;
|
||||||
final bool allFilesAreImages =
|
final allFilesAreImages =
|
||||||
widget.files.every((file) => file is MatrixImageFile);
|
widget.files.every((file) => file is MatrixImageFile);
|
||||||
final sizeString = widget.files
|
final sizeString = widget.files
|
||||||
.fold<double>(0, (p, file) => p + file.bytes.length)
|
.fold<double>(0, (p, file) => p + file.bytes.length)
|
||||||
|
|
|
@ -165,7 +165,7 @@ class ClientChooserButton extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
|
|
||||||
int clientCount = 0;
|
var clientCount = 0;
|
||||||
matrix.accountBundles.forEach((key, value) => clientCount += value.length);
|
matrix.accountBundles.forEach((key, value) => clientCount += value.length);
|
||||||
return FutureBuilder<Profile>(
|
return FutureBuilder<Profile>(
|
||||||
future: matrix.client.fetchOwnProfile(),
|
future: matrix.client.fetchOwnProfile(),
|
||||||
|
@ -292,7 +292,7 @@ class ClientChooserButton extends StatelessWidget {
|
||||||
);
|
);
|
||||||
// beginning from end if negative
|
// beginning from end if negative
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
int clientCount = 0;
|
var clientCount = 0;
|
||||||
matrix.accountBundles
|
matrix.accountBundles
|
||||||
.forEach((key, value) => clientCount += value.length);
|
.forEach((key, value) => clientCount += value.length);
|
||||||
_handleKeyboardShortcut(matrix, clientCount, context);
|
_handleKeyboardShortcut(matrix, clientCount, context);
|
||||||
|
@ -312,7 +312,7 @@ class ClientChooserButton extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
int? _shortcutIndexOfClient(MatrixState matrix, Client client) {
|
int? _shortcutIndexOfClient(MatrixState matrix, Client client) {
|
||||||
int index = 0;
|
var index = 0;
|
||||||
|
|
||||||
final bundles = matrix.accountBundles.keys.toList()
|
final bundles = matrix.accountBundles.keys.toList()
|
||||||
..sort(
|
..sort(
|
||||||
|
|
|
@ -82,7 +82,7 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<String> findDatabasePath(Client client) async {
|
static Future<String> findDatabasePath(Client client) async {
|
||||||
String path = client.clientName;
|
var path = client.clientName;
|
||||||
if (!kIsWeb) {
|
if (!kIsWeb) {
|
||||||
Directory directory;
|
Directory directory;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue