Skip to content

Commit

Permalink
linter + flutter 3.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed May 23, 2024
1 parent 198bd74 commit 8ecbad8
Show file tree
Hide file tree
Showing 71 changed files with 1,148 additions and 825 deletions.
1 change: 0 additions & 1 deletion lib/app/shared/enum/credential_category.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:altme/l10n/l10n.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

enum CredentialCategory {
advantagesCards,
Expand Down
1 change: 0 additions & 1 deletion lib/app/shared/validators/wallet_address_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ mixin WalletAddressValidator {
} else if (address.startsWith('0x')) {
return _validEtherumAddress(address);
} else if (address.startsWith('tz')) {
// TODO(all): validate tezos address
return address.length > 8;
} else {
// The wallet not support other blockchains
Expand Down
8 changes: 4 additions & 4 deletions lib/app/shared/widget/base/otp_textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ class OtpTextField extends StatelessWidget {
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
width: 1,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
width: 1.5,
),
),
Expand All @@ -67,7 +67,7 @@ class OtpTextField extends StatelessWidget {
}
},
onTap: () {
// Move the cursor to the end of the text when the TextField gains focus
// Move the cursor to the end of the text when TextField get focus
controllers[index].selection = TextSelection.fromPosition(
TextPosition(offset: controllers[index].text.length),
);
Expand Down
4 changes: 2 additions & 2 deletions lib/app/shared/widget/base/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class _BasePageState extends State<BasePage> with WidgetsBindingObserver {
widget.floatingActionButtonLocation,
extendBody: widget.extendBelow ?? false,
backgroundColor: widget.backgroundColor ??
Theme.of(context).colorScheme.background,
Theme.of(context).colorScheme.surface,
appBar: (widget.title == null &&
widget.titleLeading == null &&
widget.titleTrailing == null)
Expand Down Expand Up @@ -172,7 +172,7 @@ class _BasePageState extends State<BasePage> with WidgetsBindingObserver {
floatingActionButtonLocation: widget.floatingActionButtonLocation,
extendBody: widget.extendBelow ?? false,
backgroundColor: widget.backgroundColor ??
Theme.of(context).colorScheme.background,
Theme.of(context).colorScheme.surface,
appBar: (widget.title == null &&
widget.titleLeading == null &&
widget.titleTrailing == null)
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/widget/base/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class BaseTextField extends StatelessWidget {
width: 1.5,
),
),
fillColor: fillColor ?? Theme.of(context).colorScheme.background,
fillColor: fillColor ?? Theme.of(context).colorScheme.surface,
filled: true,
errorText: error,
labelText: label,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/widget/button/my_elevated_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MyElevatedButton extends StatelessWidget {
),
)
: ElevatedButton.icon(
icon: icon!,
icon: icon,
style: elevatedStyleFrom(
borderRadius: borderRadius,
context: context,
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/widget/button/my_gradient_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class MyGradientButton extends StatelessWidget {
),
)
: ElevatedButton.icon(
icon: icon!,
icon: icon,
style: gradientStyleFrom(
elevation: elevation,
verticalSpacing: verticalSpacing,
Expand Down
4 changes: 2 additions & 2 deletions lib/app/shared/widget/button/my_outlined_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MyOutlinedButton extends StatelessWidget {
),
)
: OutlinedButton.icon(
icon: icon!,
icon: icon,
style: outlinedStyleFrom(
borderRadius: borderRadius,
context: context,
Expand Down Expand Up @@ -100,7 +100,7 @@ ButtonStyle outlinedStyleFrom({
padding: EdgeInsets.symmetric(vertical: verticalSpacing),
elevation: elevation,
backgroundColor:
backgroundColor ?? Theme.of(context).colorScheme.background,
backgroundColor ?? Theme.of(context).colorScheme.surface,
side: BorderSide(
color: onPressed == null
? Theme.of(context).colorScheme.disabledBgColor
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/widget/custom_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CustomAppBar extends PreferredSize {

@override
Widget build(BuildContext context) => ColoredBox(
color: Theme.of(context).colorScheme.background,
color: Theme.of(context).colorScheme.surface,
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/widget/numeric_keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class KeyboardButton extends StatelessWidget {
: Theme.of(context).colorScheme.background,
splashColor: allowAction
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.background,
: Theme.of(context).colorScheme.surface,
onLongPress: () {
if (!allowAction) return;
onLongPress?.call(semanticsLabel);
Expand Down
10 changes: 0 additions & 10 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import 'package:altme/splash/splash.dart';
import 'package:altme/theme/theme.dart';
import 'package:altme/wallet/wallet.dart';
import 'package:beacon_flutter/beacon_flutter.dart';
import 'package:device_preview/device_preview.dart';
import 'package:did_kit/did_kit.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -281,22 +280,13 @@ class MaterialAppDefinition extends StatelessWidget {

@override
Widget build(BuildContext context) {
final bool isStaging =
context.read<FlavorCubit>().flavorMode == FlavorMode.staging;
return BlocBuilder<LangCubit, LangState>(
builder: (context, state) {
if (isStaging) {
final locale = DevicePreview.locale(context);
if (locale != null) {
context.read<LangCubit>().setLocale(locale);
}
}
if (state.locale == const Locale('en')) {
context.read<LangCubit>().checkLocale();
}

return MaterialApp(
builder: isStaging ? DevicePreview.appBuilder : null,
locale: state.locale,
title: 'AltMe',
darkTheme: AppTheme.darkThemeData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/theme/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class ConfidentialClientWidget extends StatelessWidget {
text: state.model.profileSetting.selfSovereignIdentityOptions
.customOidc4vcProfile.clientSecret,
);

final clientId = state.model.profileSetting.selfSovereignIdentityOptions
.customOidc4vcProfile.clientId;
final clientSecret = state.model.profileSetting
.selfSovereignIdentityOptions.customOidc4vcProfile.clientSecret;
return OptionContainer(
title: l10n.confidentialClient,
body: Padding(
Expand Down Expand Up @@ -128,7 +131,7 @@ class ConfidentialClientWidget extends StatelessWidget {
children: [
Expanded(
child: Text(
'${l10n.clientId}: ${state.model.profileSetting.selfSovereignIdentityOptions.customOidc4vcProfile.clientId}',
'${l10n.clientId}: $clientId',
style:
Theme.of(context).textTheme.drawerItemSubtitle,
),
Expand Down Expand Up @@ -226,7 +229,7 @@ class ConfidentialClientWidget extends StatelessWidget {
),
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).colorScheme.onBackground,
color: Theme.of(context).colorScheme.onSurface,
),
borderRadius: const BorderRadius.all(
Radius.circular(
Expand All @@ -240,7 +243,7 @@ class ConfidentialClientWidget extends StatelessWidget {
Expanded(
child: Text(
'${l10n.clientSecret}: '
'${state.model.profileSetting.selfSovereignIdentityOptions.customOidc4vcProfile.clientSecret}',
'$clientSecret',
style:
Theme.of(context).textTheme.drawerItemSubtitle,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class _RestoreCredentialViewState extends State<RestoreCredentialView> {

Future<void> _pickRestoreFile() async {
final l10n = context.l10n;
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;

/// storage permission has changed with android 13
late final PermissionStatus storagePermission;
Expand Down
154 changes: 0 additions & 154 deletions lib/dashboard/home/home/cubit/home_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,158 +271,4 @@ class HomeCubit extends Cubit<HomeState> {
Future<void> launchUrl({String? link}) async {
await LaunchUrl.launch(link ?? state.link!);
}

// Future<void> periodicCheckRewardOnTezosBlockchain() async {
// Timer.periodic(const Duration(minutes: 1), (timer) async {
// List<String> walletAddresses = [];
// final String? savedCryptoAccount =
// await secureStorageProvider.get(SecureStorageKeys.cryptoAccount);

// if (savedCryptoAccount != null && savedCryptoAccount.isNotEmpty) {
// //load all the content of walletAddress
// final cryptoAccountJson =
// jsonDecode(savedCryptoAccount) as Map<String, dynamic>;
// final CryptoAccount cryptoAccount =
// CryptoAccount.fromJson(cryptoAccountJson);

// walletAddresses =
// cryptoAccount.data.map((e) => e.walletAddress).toList();
// }
// if (walletAddresses.isEmpty) return;
// try {
// final tezosWalletAddresses =
// walletAddresses.where((e) => e.startsWith('tz')).toList();
// if (tezosWalletAddresses.isEmpty) return;
// await checkRewards(tezosWalletAddresses);
// } catch (e, s) {
// getLogger('HomeCubit')
// .e('error in checking for reward , error: $e, stack: $s');
// }
// });
// }

// Future<void> checkRewards(List<String> walletAddresses) async {
// for (int i = 0; i < walletAddresses.length; i++) {
// await checkUNOReward(walletAddresses[i]);
// await checkXTZReward(walletAddresses[i]);
// }
// }

// Future<void> checkUNOReward(String walletAddress) async {
// getLogger('HomeCubit').i('check for UNO reward');
// final response = await client.get(
// '${Urls.tzktMainnetUrl}/v1/tokens/transfers',
// queryParameters: <String, dynamic>{
// 'from': 'tz1YtKsJMx5FqhULTDzNxs9r9QYHBGsmz58o', // tezotopia
// 'to': walletAddress,
// 'token.contract.eq': 'KT1ErKVqEhG9jxXgUG2KGLW3bNM7zXHX8SDF', // UNO
// 'sort.desc': 'timestamp',
// },
// ) as List<dynamic>;

// if (response.isEmpty) {
// return;
// }

// final operations = response
// .map(
// (dynamic e) => OperationModel.fromFa2Json(e as Map<String, dynamic>),
// )
// .toList();

// final String? lastNotifiedRewardId = await secureStorageProvider.get(
// SecureStorageKeys.lastNotifiedUNORewardId + walletAddress,
// );

// final lastOperation = operations.first; //operations sorted by time in api
// if (lastOperation.id.toString() == lastNotifiedRewardId) {
// return;
// } else {
// // save the operation id to storage
// await secureStorageProvider.set(
// SecureStorageKeys.lastNotifiedUNORewardId + walletAddress,
// lastOperation.id.toString(),
// );

// emit(
// state.copyWith(
// status: AppStatus.gotTokenReward,
// tokenReward: TokenReward(
// amount: lastOperation.calcAmount(
// decimal: 9, //UNO
// value: lastOperation.amount.toString(),
// ),
// txId: lastOperation.hash,
// counter: lastOperation.counter,
// account: walletAddress,
// origin:
// 'Tezotopia Membership Card', // TODO(all): dynamic text later
// symbol: 'UNO',
// name: 'Unobtanium',
// ),
// ),
// );
// }
// }

// Future<void> checkXTZReward(String walletAddress) async {
// getLogger('HomeCubit').i('check for XTZ reward');

// final result = await client.get(
// '${Urls.tzktMainnetUrl}/v1/operations/transactions',
// queryParameters: <String, dynamic>{
// 'sender': 'tz1YtKsJMx5FqhULTDzNxs9r9QYHBGsmz58o', // tezotopia
// 'target': walletAddress,
// 'amount.gt': 0,
// },
// ) as List<dynamic>;

// if (result.isEmpty) {
// return;
// }

// final operations = result
// .map(
// (dynamic e) => OperationModel.fromJson(e as Map<String, dynamic>),
// )
// .toList();
// //sort for last transaction at first
// operations.sort(
// (a, b) => b.dateTime.compareTo(a.dateTime),
// );

// final String? lastNotifiedRewardId = await secureStorageProvider.get(
// SecureStorageKeys.lastNotifiedXTZRewardId + walletAddress,
// );

// final lastOperation = operations.first; //operations sorted by time in api
// if (lastOperation.id.toString() == lastNotifiedRewardId) {
// return;
// } else {
// // save the operation id to storage
// await secureStorageProvider.set(
// SecureStorageKeys.lastNotifiedXTZRewardId + walletAddress,
// lastOperation.id.toString(),
// );

// emit(
// state.copyWith(
// status: AppStatus.gotTokenReward,
// tokenReward: TokenReward(
// amount: lastOperation.calcAmount(
// decimal: 6, //XTZ
// value: lastOperation.amount.toString(),
// ),
// account: walletAddress,
// txId: lastOperation.hash,
// counter: lastOperation.counter,
// origin:
// 'Tezotopia Membership Card', // TODO(all): dynamic text later
// symbol: 'XTZ',
// name: 'Tezos',
// ),
// ),
// );
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:altme/l10n/l10n.dart';
import 'package:altme/polygon_id/polygon_id.dart';
import 'package:altme/selective_disclosure/selective_disclosure.dart';
import 'package:altme/selective_disclosure/widget/display_selective_disclosure.dart';
import 'package:altme/theme/theme.dart';
import 'package:altme/wallet/cubit/wallet_cubit.dart';
import 'package:did_kit/did_kit.dart';
import 'package:dio/dio.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,9 @@ class _GenerateLinkedinQrViewState extends State<GenerateLinkedinQrView> {
: FractionallySizedBox(
heightFactor: 0.48,
widthFactor: 0.12,
child: PrettyQr(
size: 300,
child: PrettyQrView.data(
data: state.qrValue!,
errorCorrectLevel: QrErrorCorrectLevel.M,
typeNumber: null,
roundEdges: true,
),
),
),
Expand Down
Loading

0 comments on commit 8ecbad8

Please sign in to comment.