Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate TextTheme and dependencies for latest version of Flutter #1958

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 11 additions & 5 deletions lib/components/error_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ class ErrorDialog extends StatelessWidget {
final String details;
final VoidCallback? onRightButtonPressed;

n13 marked this conversation as resolved.
Show resolved Hide resolved
const ErrorDialog({super.key, required this.title, required this.details, this.onRightButtonPressed});
const ErrorDialog(
{super.key,
required this.title,
required this.details,
this.onRightButtonPressed});

Future<void> show(BuildContext context) {
return showDialog<void>(context: context, barrierDismissible: false, builder: (_) => this);
return showDialog<void>(
context: context, barrierDismissible: false, builder: (_) => this);
}

@override
Widget build(BuildContext context) {
return CustomDialog(
icon: const CustomPaint(size: Size(60, 60), painter: RedExclamationCircle()),
icon: const CustomPaint(
size: Size(60, 60), painter: RedExclamationCircle()),
rightButtonTitle: 'Retry',
onRightButtonPressed: () {
Navigator.of(context).pop();
Expand All @@ -27,11 +33,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
11 changes: 8 additions & 3 deletions lib/components/full_page_error_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class FullPageErrorIndicator extends StatelessWidget {
final String? buttonTitle;
final VoidCallback? buttonOnPressed;

const FullPageErrorIndicator({this.errorMessage, this.buttonTitle, this.buttonOnPressed, super.key});
const FullPageErrorIndicator(
{this.errorMessage, this.buttonTitle, this.buttonOnPressed, super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -19,15 +20,19 @@ 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),
),
),
),
),
if (buttonTitle != null && buttonOnPressed != null)
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
child: FlatButtonLong(title: buttonTitle!, onPressed: buttonOnPressed),
child:
FlatButtonLong(title: buttonTitle!, onPressed: buttonOnPressed),
),
]);
}
Expand Down
12 changes: 8 additions & 4 deletions lib/components/member_info_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ class MemberInfoRow extends StatelessWidget {
children: [
Flexible(
child: Text(
member.nickname.isNotEmpty ? member.nickname : member.account,
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,
),
],
),
const SizedBox(height: 8),
Text(member.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis)
Text(member.account,
style:
Theme.of(context).textTheme.subtitle2OpacityEmphasis)
],
),
),
Expand Down
13 changes: 9 additions & 4 deletions lib/components/search_result_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,25 @@ class SearchResultRow extends StatelessWidget {
children: [
Flexible(
child: Text(
member.nickname.isNotEmpty ? member.nickname : member.account,
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,
),
],
),
const SizedBox(height: 8),
Text(member.account, style: Theme.of(context).textTheme.subtitle2OpacityEmphasis)
Text(member.account,
style: Theme.of(context)
.textTheme
.subtitle2OpacityEmphasis)
],
),
),
Expand Down
16 changes: 11 additions & 5 deletions lib/components/search_user/search_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@ class SearchUser extends StatelessWidget {
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(right: horizontalEdgePadding, left: horizontalEdgePadding, top: 10),
padding: EdgeInsets.only(
right: horizontalEdgePadding,
left: horizontalEdgePadding,
top: 10),
child: SearchUserTextField(),
),
if (title != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: horizontalEdgePadding),
padding:
const EdgeInsets.symmetric(horizontal: horizontalEdgePadding),
child: Align(
alignment: Alignment.centerLeft,
child: Column(
children: [
const SizedBox(height: 20),
Text(title!, style: Theme.of(context).textTheme.subtitle2),
Text(title!, style: Theme.of(context).textTheme.titleSmall),
],
),
),
Expand All @@ -52,10 +56,12 @@ class SearchUser extends StatelessWidget {
case PageState.loading:
case PageState.failure:
case PageState.success:
if (state.pageState == PageState.success && state.users.isEmpty) {
if (state.pageState == PageState.success &&
state.users.isEmpty) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Center(child: Text(context.loc.searchUserNoUserFound)),
child: Center(
child: Text(context.loc.searchUserNoUserFound)),
);
} else {
return Expanded(
Expand Down
8 changes: 6 additions & 2 deletions lib/components/select_picture_box/select_picture_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class SelectPictureBox extends StatelessWidget {
dashPattern: [8, 4],
strokeWidth: 2,
color: AppColors.grey,
child: Ink(height: 200, child: Container(width: width, child: imageState(pictureBoxState, context)))));
child: Ink(
height: 200,
child: Container(
width: width,
child: imageState(pictureBoxState, context)))));
}

Widget imageState(PictureBoxState pictureState, BuildContext context) {
Expand All @@ -46,7 +50,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
14 changes: 9 additions & 5 deletions lib/components/text_form_field_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,24 @@ 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)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: AppColors.canopy)),
counterText: counterText,
hintText: hintText,
labelText: labelText,
errorText: errorText,
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,
labelStyle: Theme.of(context)
.textTheme
.subtitle3
.copyWith(color: AppColors.white),
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
Loading