Skip to content

Commit

Permalink
Migrate TextTheme and dependencies for latest version of Flutter (#1958)
Browse files Browse the repository at this point in the history
* bump sdk version & replace/upgrade dependencies

* migrate deprecated TextTheme for Flutter >3.19

* apply dart linter recommendations

* set line length to 120

* line length to 120 (missed ths=is file in last commit)

* change `callbackURL` to `parsedUrl`
  • Loading branch information
mdmohsin7 authored Jun 21, 2024
1 parent ae9e974 commit 91f3795
Show file tree
Hide file tree
Showing 136 changed files with 457 additions and 470 deletions.
2 changes: 1 addition & 1 deletion lib/components/custom_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class CustomDialog extends StatelessWidget {
child: CircleAvatar(
backgroundColor: Colors.transparent,
radius: _avatarRadius,
child: Container(
child: DecoratedBox(
decoration: BoxDecoration(
color: AppColors.white,
shape: BoxShape.circle,
Expand Down
4 changes: 2 additions & 2 deletions lib/components/error_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class ErrorDialog extends StatelessWidget {
children: [
Text(
title,
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 20.0),
Text(details, style: Theme.of(context).textTheme.subtitle2),
Text(details, style: Theme.of(context).textTheme.titleSmall),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/components/full_page_error_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FullPageErrorIndicator extends StatelessWidget {
child: Center(
child: Text(
errorMessage ?? GlobalError.unknown.localizedDescription(context),
style: Theme.of(context).textTheme.subtitle2!.copyWith(color: AppColors.red1),
style: Theme.of(context).textTheme.titleSmall!.copyWith(color: AppColors.red1),
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/components/member_info_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class MemberInfoRow extends StatelessWidget {
child: Text(
member.nickname.isNotEmpty ? member.nickname : member.account,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.button,
style: Theme.of(context).textTheme.labelLarge,
),
),
Text(
member.statusString,
style: Theme.of(context).textTheme.button,
style: Theme.of(context).textTheme.labelLarge,
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions lib/components/search_result_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class SearchResultRow extends StatelessWidget {
child: Text(
member.nickname.isNotEmpty ? member.nickname : member.account,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.button,
style: Theme.of(context).textTheme.labelLarge,
),
),
const SizedBox(width: 10),
Text(
member.statusString,
style: Theme.of(context).textTheme.button,
style: Theme.of(context).textTheme.labelLarge,
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/components/search_user/search_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SearchUser extends StatelessWidget {
child: Column(
children: [
const SizedBox(height: 20),
Text(title!, style: Theme.of(context).textTheme.subtitle2),
Text(title!, style: Theme.of(context).textTheme.titleSmall),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/components/select_picture_box/select_picture_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SelectPictureBox extends StatelessWidget {
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
const Icon(Icons.add),
const SizedBox(width: 6),
Text(title, style: Theme.of(context).textTheme.subtitle2)
Text(title, style: Theme.of(context).textTheme.titleSmall)
])
]);
case PictureBoxState.imagePicked:
Expand Down
4 changes: 1 addition & 3 deletions lib/components/snack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ class Snack extends SnackBar {
return Snack._(title, scaffoldMessengerState, color: color, duration: duration);
}

Snack._(this.title, this.scaffoldMessengerState, {Key? key, required Color color, required Duration duration})
Snack._(this.title, this.scaffoldMessengerState, {required Color color, required super.duration})
: super(
key: key,
backgroundColor: color,
duration: duration,
content: Row(
children: [
Expanded(child: Text(title, textAlign: TextAlign.center)),
Expand Down
6 changes: 3 additions & 3 deletions lib/components/text_form_field_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class TextFormFieldCustom extends StatelessWidget {
maxLines: maxLines,
enabled: enabled,
validator: validator,
style: Theme.of(context).textTheme.subtitle2,
style: Theme.of(context).textTheme.titleSmall,
decoration: InputDecoration(
suffixText: suffixText,
suffixStyle: Theme.of(context).textTheme.subtitle2,
suffixStyle: Theme.of(context).textTheme.titleSmall,
suffixIcon: suffixIcon,
focusedBorder: const OutlineInputBorder(borderSide: BorderSide(color: AppColors.canopy)),
counterText: counterText,
Expand All @@ -89,7 +89,7 @@ class TextFormFieldCustom extends StatelessWidget {
errorMaxLines: 2,
errorStyle: const TextStyle(color: Colors.red, wordSpacing: 4.0),
labelStyle: Theme.of(context).textTheme.subtitle3.copyWith(color: AppColors.white),
hintStyle: Theme.of(context).textTheme.button,
hintStyle: Theme.of(context).textTheme.labelLarge,
contentPadding: const EdgeInsets.all(16.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/dart_esr/src/encoding_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DefaultAbiProvider implements AbiProvider {
class DefaultTextEncoder implements TextEncoder {
@override
Uint8List encode(String input) {
return utf8.encode(input) as Uint8List;
return utf8.encode(input);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/crypto/dart_esr/src/signing_request_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class SigningRequestManager {
case 'action':
return [Action.fromJson(Map<String, dynamic>.from(req[1]))];
case 'action[]':
print("*** actions: ${req.toString()}");
print("*** actions: $req");

final actions = req[1] as List;
final List<Action> resultActions = List.from(actions.map(
Expand Down Expand Up @@ -674,7 +674,7 @@ class ResolvedSigningRequest {
refBlockNnum = int.parse(payload.rbn!);
refBlockPrefix = int.parse(payload.rid!);
} catch (e) {
print("Error fromPayload: ${e.toString()}");
print("Error fromPayload: $e");
}

return request.resolve(
Expand Down
3 changes: 1 addition & 2 deletions lib/crypto/dart_esr/zlib/src/util/archive_exception.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// An exception thrown when there was a problem in the archive library.
class ArchiveException extends FormatException {
ArchiveException(String message, [dynamic source, int? offset])
: super(message, source, offset);
ArchiveException(super.message, [super.source, super.offset]);
}
2 changes: 1 addition & 1 deletion lib/crypto/eosdart/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class EOSClient {
/// Get required key by transaction from EOS blockchain
Future<RequiredKeys> getRequiredKeys(Transaction transaction, List<String> availableKeys) async {
final NodeInfo info = await getInfo();
final Block refBlock = await getBlock((info.headBlockNum).toString());
final Block refBlock = await getBlock(info.headBlockNum.toString());
Transaction trx = await _fullFill(transaction, refBlock);
trx = await _serializeActions(trx);

Expand Down
4 changes: 2 additions & 2 deletions lib/crypto/eosdart/src/models/abi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import 'dart:typed_data';

import 'package:json_annotation/json_annotation.dart';

import './conversion_helper.dart';
import '../eosdart_base.dart';
import '../jsons.dart';
import '../numeric.dart';
import '../serialize.dart' as ser;
import './conversion_helper.dart';

part 'abi.g.dart';

Expand Down Expand Up @@ -65,7 +65,7 @@ class AbiResp with ConversionHelper {
var b = t.deserialize!(t, buffer);
return Abi.fromJson(json.decode(json.encode(b)));
} catch (e) {
print(e.toString());
print(e);
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/eosdart/src/models/conversion_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mixin ConversionHelper {
}

static Uint8List base64ToBuffer(String base64String) {
return utf8.encode(base64String) as Uint8List;
return utf8.encode(base64String);
}

static String bufferToBase64(Uint8List buffer) {
Expand Down
5 changes: 3 additions & 2 deletions lib/crypto/eosdart/src/models/transaction.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// ignore_for_file: always_use_package_imports, unnecessary_this, prefer_final_locals

import 'dart:typed_data';

import 'package:json_annotation/json_annotation.dart';

import './action.dart';
import './conversion_helper.dart';
import '../eosdart_base.dart';
import '../serialize.dart' as ser;
import './action.dart';
import './conversion_helper.dart';

part 'transaction.g.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/crypto/eosdart/src/numeric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ Uint8List digestSha256X2(Uint8List data) {
IKey stringToKey(String s, KeyType type, int size, String suffix) {
var whole = base58ToBinary(size + 4, s);

var result;
var digest;
IKey result;
List<int> digest;
if (suffix == '') {
result = IKey(type, whole.sublist(1,size));
digest = digestSha256X2(whole.sublist(0,size));
Expand Down
4 changes: 2 additions & 2 deletions lib/crypto/eosdart/src/serialize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ Type createType(
void Function(Type self, SerialBuffer buffer, Object data, {SerializerState state, bool allowExtensions})?
serialize,
Object? Function(Type self, SerialBuffer buffer, {SerializerState? state, bool? allowExtensions})? deserialize,
String? baseName: "",
List<Field>? fields: const [],
String? baseName = "",
List<Field>? fields = const [],
Type? extensionOf}) {
var t = Type(
aliasOfName: aliasOfName,
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto/eosdart_ecc/src/key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class EOSPrivateKey extends EOSKey {

/// Sign the string data using the private key
EOSSignature signString(String data) {
return sign(utf8.encode(data) as Uint8List);
return sign(utf8.encode(data));
}

/// Sign the SHA256 hashed data using the private key
Expand Down
4 changes: 2 additions & 2 deletions lib/crypto/eosdart_ecc/src/key_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class EOSKey {
} else {
Uint8List check = key;
if (keyType != null) {
check = concat(key, utf8.encode(keyType) as Uint8List);
check = concat(key, utf8.encode(keyType));
}
newChecksum = RIPEMD160Digest().process(check).sublist(0, 4);
}
Expand All @@ -52,7 +52,7 @@ abstract class EOSKey {

Uint8List keyBuffer = key;
if (keyType != null) {
keyBuffer = concat(key, utf8.encode(keyType) as Uint8List);
keyBuffer = concat(key, utf8.encode(keyType));
}
Uint8List checksum = RIPEMD160Digest().process(keyBuffer).sublist(0, 4);
return base58.encode(concat(key, checksum));
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/local/biometrics_service.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/services.dart' show PlatformException;
import 'package:local_auth/local_auth.dart';
import 'package:local_auth_android/local_auth_android.dart';
import 'package:local_auth_ios/local_auth_ios.dart';
import 'package:local_auth_darwin/local_auth_darwin.dart';

class BiometricsService {
final LocalAuthentication _localAuth;
Expand Down
8 changes: 4 additions & 4 deletions lib/datasource/remote/api/esr_callback_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart';
/// At the moment can't justify the effort for a generic implementation.
class ESRCallbackRepository extends HttpRepository {
Future<Result<bool>> callback(String _callbackUrl, String transactionId) {
print("[http] issue callback $_callbackUrl");
Future<Result<bool>> callback(String callbackUrl, String transactionId) {
print("[http] issue callback $callbackUrl");

final callbackUrl = fillTemplate(_callbackUrl, transactionId);
final uri = Uri.parse(callbackUrl);
final parsedUrl = fillTemplate(callbackUrl, transactionId);
final uri = Uri.parse(parsedUrl);
final params = jsonEncode(uri.queryParameters);
final postURI = Uri(scheme: uri.scheme, host: uri.host, path: uri.path);

Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/remote/api/guardians_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class GuardiansRepository extends EosRepository with HttpRepository {

final permissionsMap = _requiredAuthToJson(permission.requiredAuth!);

print('converted JSPN: ${permissionsMap.toString()}');
print('converted JSPN: $permissionsMap');
final accountName = settingsStorage.accountName;

final actions = [
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/remote/api/invite_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class InviteRepository extends HttpRepository with EosRepository {
print('[http] find invite by hash');

final inviteURL = Uri.parse('$baseURL/v1/chain/get_table_rows');
// 'https://node.hypha.earth/v1/chain/get_table_rows'; // todo: Why is this still Hypha when config has changed?
// 'https://node.hypha.earth/v1/chain/get_table_rows'; // `todo`: Why is this still Hypha when config has changed?

final request = createRequest(
code: SeedsCode.accountJoin,
Expand Down
5 changes: 1 addition & 4 deletions lib/datasource/remote/api/stat_repository.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import 'package:async/async.dart';
import 'package:http/http.dart' as http;
import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart';
import 'package:seeds/datasource/remote/model/balance_model.dart';
import 'package:seeds/datasource/remote/model/token_model.dart';
import 'package:seeds/datasource/remote/model/stat_model.dart';

class StatRepository extends HttpRepository {
Future<Result<StatModel>> getTokenStat(
{required String tokenContract, required String symbol}) {
Future<Result<StatModel>> getTokenStat({required String tokenContract, required String symbol}) {
print('[http] get getTokenStat for $symbol');

final String request = '''
Expand Down
Loading

0 comments on commit 91f3795

Please sign in to comment.