From a7d3353030ac3f8d77c924d372b8b248439659fb Mon Sep 17 00:00:00 2001 From: phuoc Date: Mon, 8 Jan 2024 14:24:55 +0700 Subject: [PATCH 1/2] change superteal to ff yellow Signed-off-by: phuoc --- lib/screen/bug_bounty_page.dart | 97 ++-- .../customer_support/support_thread_page.dart | 439 ++++++++++-------- .../detail/preview/artwork_preview_page.dart | 103 ++-- lib/screen/detail/preview_primer.dart | 2 +- lib/screen/home/home_navigation_page.dart | 4 +- lib/screen/migration/key_sync_page.dart | 104 ++--- lib/screen/participate_user_test_page.dart | 2 +- .../edit_playlist/edit_playlist.dart | 2 +- .../list_playlists/list_playlists.dart | 4 +- .../view_playlist/view_playlist.dart | 2 +- lib/screen/release_notes_page.dart | 27 +- .../linked_wallet_detail_page.dart | 2 +- .../wallet_detail/wallet_detail_page.dart | 2 +- lib/screen/wallet/wallet_page.dart | 2 +- .../wallet_connect/wc_connect_page.dart | 7 +- lib/service/customer_support_service.dart | 96 ++-- lib/util/inapp_notifications.dart | 62 ++- lib/util/style.dart | 12 +- lib/util/ui_helper.dart | 8 +- lib/view/artwork_common_widget.dart | 18 +- lib/view/canvas_device_view.dart | 16 +- lib/view/important_note_view.dart | 14 +- lib/view/modal_widget.dart | 47 +- lib/view/number_picker.dart | 109 ----- lib/view/tip_card.dart | 122 ++--- pubspec.lock | 4 +- pubspec.yaml | 2 +- 27 files changed, 614 insertions(+), 695 deletions(-) delete mode 100644 lib/view/number_picker.dart diff --git a/lib/screen/bug_bounty_page.dart b/lib/screen/bug_bounty_page.dart index 2019a58a1..021ee3624 100644 --- a/lib/screen/bug_bounty_page.dart +++ b/lib/screen/bug_bounty_page.dart @@ -19,27 +19,27 @@ import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class BugBountyPage extends StatelessWidget { - const BugBountyPage({Key? key}) : super(key: key); + const BugBountyPage({super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); Map guidelines = { - "critical".tr(): "guidelines_critical".tr(), + 'critical'.tr(): 'guidelines_critical'.tr(), //"Key leaks or invalid transactions resulting in asset loss: Up to \$5,000", - "high".tr(): "guidelines_high".tr(), + 'high'.tr(): 'guidelines_high'.tr(), // "Crashes or user data loss: \$100 - \$500", - "medium".tr(): "guidelines_medium".tr(), + 'medium'.tr(): 'guidelines_medium'.tr(), //"Incorrect flows or incompatibility with protocol or dapps: \$50 - \$100", - "low".tr(): "guidelines_low".tr(), + 'low'.tr(): 'guidelines_low'.tr(), // "UI typos, alignment errors: \$10 - \$50", }; return Scaffold( appBar: getBackAppBar( context, - title: "bug_bounty".tr(), + title: 'bug_bounty'.tr(), onBack: () => Navigator.of(context).pop(), ), body: Container( @@ -50,8 +50,7 @@ class BugBountyPage extends StatelessWidget { children: [ addTitleSpace(), Text( - "we_value_feedback".tr(), - //"We greatly value feedback from our customers and the work done by security researchers in improving the usability and security of Autonomy. We are committed to quickly verify, reproduce, and respond to legitimate reported interface issues and vulnerabilities. ", + 'we_value_feedback'.tr(), style: theme.textTheme.ppMori400Black16, ), const SizedBox(height: 32), @@ -62,8 +61,7 @@ class BugBountyPage extends StatelessWidget { style: theme.textTheme.ppMori400Black16, children: [ TextSpan( - text: "only_accept_new_bug".tr(), - //'We only accept new bug reports for our iPhone or Android Apps; please check our ', + text: 'only_accept_new_bug'.tr(), ), TextSpan( recognizer: TapGestureRecognizer() @@ -79,16 +77,14 @@ class BugBountyPage extends StatelessWidget { : theme.textTheme.linkStyle16, ), TextSpan( - text: "not_reward_yet".tr(), - //' before submitting. Bug reports for web applications or any other projects are out of scope and will not be considered for rewards.', + text: 'not_reward_yet'.tr(), ), ])), const SizedBox(height: 32), Text('rewards'.tr(), style: theme.textTheme.ppMori700Black24), const SizedBox(height: 32), Text( - "reward_ranging".tr(), - //'We pay rewards ranging from \$10 to \$5,000, administered according to the following guidelines:', + 'reward_ranging'.tr(), style: theme.textTheme.ppMori400Black16, ), const SizedBox(height: 32), @@ -96,7 +92,7 @@ class BugBountyPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -109,44 +105,42 @@ class BugBountyPage extends StatelessWidget { .copyWith(fontWeight: FontWeight.bold), ), const SizedBox(height: 12), - ...guidelines.keys - .map( - (e) => Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox( - width: 8, - ), - Text( - ' • ', + ...guidelines.keys.map( + (e) => Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox( + width: 8, + ), + Text( + ' • ', + style: theme.textTheme.ppMori400Black14, + textAlign: TextAlign.start, + ), + Expanded( + child: RichText( + text: TextSpan( style: theme.textTheme.ppMori400Black14, - textAlign: TextAlign.start, - ), - Expanded( - child: RichText( - text: TextSpan( - style: theme.textTheme.ppMori400Black14, - children: [ - TextSpan( - text: e, - style: ResponsiveLayout.isMobile - ? theme.textTheme.ppMori400Black14 - : theme.textTheme.ppMori400Black16, - ), - TextSpan( - text: " – ${guidelines[e]!}", - style: ResponsiveLayout.isMobile - ? theme.textTheme.ppMori400Black14 - : theme.textTheme.ppMori400Black16, - ), - ], + children: [ + TextSpan( + text: e, + style: ResponsiveLayout.isMobile + ? theme.textTheme.ppMori400Black14 + : theme.textTheme.ppMori400Black16, ), - ), + TextSpan( + text: ' – ${guidelines[e]!}', + style: ResponsiveLayout.isMobile + ? theme.textTheme.ppMori400Black14 + : theme.textTheme.ppMori400Black16, + ), + ], ), - ], + ), ), - ) - .toList(), + ], + ), + ), ], ), ), @@ -159,12 +153,11 @@ class BugBountyPage extends StatelessWidget { Text('disclosure_policy'.tr(), style: theme.textTheme.ppMori700Black24), const SizedBox(height: 32), - Text("support_publication".tr(), - //'We support the open publication of security research. We do ask that you give us a heads-up before any publication so we can do a final sync-up and check. ', + Text('support_publication'.tr(), style: theme.textTheme.ppMori400Black16), const SizedBox(height: 32), PrimaryButton( - text: "report_a_bug".tr(), + text: 'report_a_bug'.tr(), onTap: () => Navigator.of(context).pushNamed( AppRouter.supportThreadPage, arguments: diff --git a/lib/screen/customer_support/support_thread_page.dart b/lib/screen/customer_support/support_thread_page.dart index 41a55372a..6d1b1ad6f 100644 --- a/lib/screen/customer_support/support_thread_page.dart +++ b/lib/screen/customer_support/support_thread_page.dart @@ -7,6 +7,7 @@ // ignore_for_file: unused_field +import 'dart:async'; import 'dart:convert'; import 'package:after_layout/after_layout.dart'; @@ -26,6 +27,7 @@ import 'package:autonomy_flutter/service/feralfile_service.dart'; import 'package:autonomy_flutter/service/metric_client_service.dart'; import 'package:autonomy_flutter/util/announcement_ext.dart'; import 'package:autonomy_flutter/util/constants.dart'; +import 'package:autonomy_flutter/util/datetime_ext.dart'; import 'package:autonomy_flutter/util/log.dart' as log_util; import 'package:autonomy_flutter/util/log.dart'; import 'package:autonomy_flutter/util/string_ext.dart'; @@ -47,8 +49,6 @@ import 'package:image_picker/image_picker.dart'; import 'package:nft_collection/models/asset_token.dart'; import 'package:uuid/uuid.dart'; -import '../../util/datetime_ext.dart'; - abstract class SupportThreadPayload { AnnouncementLocal? get announcement; } @@ -75,7 +75,7 @@ class DetailIssuePayload extends SupportThreadPayload { DetailIssuePayload( {required this.reportIssueType, required this.issueID, - this.status = "", + this.status = '', this.isRated = false, this.announcement}); } @@ -97,9 +97,9 @@ class SupportThreadPage extends StatefulWidget { final SupportThreadPayload payload; const SupportThreadPage({ - Key? key, required this.payload, - }) : super(key: key); + super.key, + }); @override State createState() => _SupportThreadPageState(); @@ -122,7 +122,7 @@ class _SupportThreadPageState extends State Pair>? _debugLog; late Object _forceAccountsViewRedraw; - var _sendIcon = "assets/images/sendMessage.svg"; + var _sendIcon = 'assets/images/sendMessage.svg'; final _introMessengerID = const Uuid().v4(); final _resolvedMessengerID = const Uuid().v4(); final _askRatingMessengerID = const Uuid().v4(); @@ -142,33 +142,33 @@ class _SupportThreadPageState extends State types.CustomMessage get _resolvedMessenger => types.CustomMessage( id: _resolvedMessengerID, author: _bitmark, - metadata: const {"status": "resolved"}, + metadata: const {'status': 'resolved'}, ); types.CustomMessage get _askRatingMessenger => types.CustomMessage( author: _bitmark, id: _askRatingMessengerID, - metadata: {"status": "rateIssue", "content": "rate_issue".tr()}, + metadata: {'status': 'rateIssue', 'content': 'rate_issue'.tr()}, createdAt: DateTime.now().millisecondsSinceEpoch, ); types.CustomMessage get _askReviewMessenger => types.CustomMessage( author: _bitmark, id: _askReviewMessengerID, - metadata: {"status": "careToShare", "content": "care_to_share".tr()}, + metadata: {'status': 'careToShare', 'content': 'care_to_share'.tr()}, createdAt: DateTime.now().millisecondsSinceEpoch, ); types.CustomMessage get _announcementMessenger => types.CustomMessage( id: _announcementMessengerID, author: _bitmark, - metadata: const {"status": "announcement"}, + metadata: const {'status': 'announcement'}, ); @override void initState() { - _fetchCustomerSupportAvailability(); - injector().processMessages(); + unawaited(_fetchCustomerSupportAvailability()); + unawaited(injector().processMessages()); injector() .triggerReloadMessages .addListener(_loadIssueDetails); @@ -183,7 +183,7 @@ class _SupportThreadPageState extends State Future.delayed(const Duration(milliseconds: 300), () { _askForAttachCrashLog(context, onConfirm: (attachCrashLog) { if (attachCrashLog) { - _addDebugLog(); + unawaited(_addDebugLog()); } else { UIHelper.hideInfoDialog(context); } @@ -201,7 +201,7 @@ class _SupportThreadPageState extends State Future.delayed(const Duration(milliseconds: 300), () { _askForAttachCrashLog(context, onConfirm: (attachCrashLog) { if (attachCrashLog) { - _addDebugLog(); + unawaited(_addDebugLog()); } else { UIHelper.hideInfoDialog(context); } @@ -215,7 +215,7 @@ class _SupportThreadPageState extends State _loadDrafts(); - if (_issueID != null && !_issueID!.startsWith("TEMP")) { + if (_issueID != null && !_issueID!.startsWith('TEMP')) { _loadIssueDetails(); } } @@ -224,13 +224,13 @@ class _SupportThreadPageState extends State void afterFirstLayout(BuildContext context) { final payload = widget.payload; if (payload.announcement != null && payload.announcement!.unread) { - _customerSupportService - .markAnnouncementAsRead(payload.announcement!.announcementContextId); + unawaited(_customerSupportService + .markAnnouncementAsRead(payload.announcement!.announcementContextId)); _callMixpanelReadAnnouncementEvent(payload.announcement!); } } - _fetchCustomerSupportAvailability() async { + Future _fetchCustomerSupportAvailability() async { final device = DeviceInfo.instance; final isAvailable = await device.isSupportOS(); setState(() { @@ -250,7 +250,7 @@ class _SupportThreadPageState extends State combinedBytes = combinedBytes.sublist(combinedBytes.length - fileMaxSize); } final filename = - "${combinedBytes.length}_${DateTime.now().microsecondsSinceEpoch}.logs"; + '${combinedBytes.length}_${DateTime.now().microsecondsSinceEpoch}.logs'; _debugLog = Pair(filename, combinedBytes); setState(() { _isFileAttached = true; @@ -259,14 +259,14 @@ class _SupportThreadPageState extends State void _callMixpanelReadAnnouncementEvent(AnnouncementLocal announcement) { final metricClient = injector.get(); - metricClient.addEvent( + unawaited(metricClient.addEvent( MixpanelEvent.readAnnouncement, data: { - "id": announcement.announcementContextId, - "type": announcement.type, - "title": announcement.title, + 'id': announcement.announcementContextId, + 'type': announcement.type, + 'title': announcement.title, }, - ); + )); } @override @@ -285,23 +285,22 @@ class _SupportThreadPageState extends State final theme = Theme.of(context); UIHelper.showDialog( context, - "attach_crash_log".tr(), + 'attach_crash_log'.tr(), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "ask_attach_crash".tr(), - //"Would you like to attach a crash log with your support request? The crash log is anonymous and will help our engineers identify the issue.", + 'ask_attach_crash'.tr(), style: theme.primaryTextTheme.ppMori400White14, ), const SizedBox(height: 40), PrimaryButton( - text: "attach_crash_logH".tr(), + text: 'attach_crash_logH'.tr(), onTap: () => onConfirm(true), ), const SizedBox(height: 10), OutlineButton( - text: "conti_no_crash_log".tr(), + text: 'conti_no_crash_log'.tr(), onTap: () => onConfirm(false), ), const SizedBox(height: 40), @@ -313,7 +312,7 @@ class _SupportThreadPageState extends State @override Widget build(BuildContext context) { - List messages = (_draftMessages + _messages); + List messages = _draftMessages + _messages; ////// this convert rating messages to customMessage type, then convert the string messages to rating bars for (int i = 0; i < messages.length; i++) { if (_isRating(messages[i])) { @@ -322,8 +321,8 @@ class _SupportThreadPageState extends State id: ratingMessengerID, author: _user, metadata: { - "status": "rating", - "rating": messages[i].metadata!["rating"], + 'status': 'rating', + 'rating': messages[i].metadata!['rating'], }, ); messages[i] = ratingMessenger; @@ -332,8 +331,9 @@ class _SupportThreadPageState extends State if (_status == 'closed' || _status == 'clickToReopen') { final ratingIndex = _firstRatingIndex(messages); - messages.insert(ratingIndex + 1, _resolvedMessenger); - messages.insert(ratingIndex + 1, _askRatingMessenger); + messages + ..insert(ratingIndex + 1, _resolvedMessenger) + ..insert(ratingIndex + 1, _askRatingMessenger); if (ratingIndex > -1 && _status == 'closed') { messages.insert(ratingIndex, _askReviewMessenger); } @@ -342,8 +342,9 @@ class _SupportThreadPageState extends State for (int i = 0; i < messages.length; i++) { if (_isRatingMessage(messages[i])) { if (messages[i + 1] != _askRatingMessenger) { - messages.insert(i + 1, _resolvedMessenger); - messages.insert(i + 1, _askRatingMessenger); + messages + ..insert(i + 1, _resolvedMessenger) + ..insert(i + 1, _askRatingMessenger); } if (i > 0 && _isCustomerSupportMessage(messages[i - 1])) { messages.insert(i, _askReviewMessenger); @@ -367,7 +368,7 @@ class _SupportThreadPageState extends State margin: EdgeInsets.zero, child: Chat( l10n: ChatL10nEn( - inputPlaceholder: "write_message".tr(), + inputPlaceholder: 'write_message'.tr(), ), customDateHeaderText: getChatDateTimeRepresentation, bubbleBuilder: _bubbleBuilder, @@ -377,48 +378,54 @@ class _SupportThreadPageState extends State messages: messages, onSendPressed: _handleSendPressed, user: _user, - listBottomWidget: (widget.payload.announcement?.isMemento6 == - true) - ? FutureBuilder( - future: _airdropService - .getTokenByContract(momaMementoContractAddresses), - builder: (context, snapshot) { - final token = snapshot.data as AssetToken?; - return Padding( - padding: const EdgeInsets.only( - left: 18, right: 18, bottom: 15), - child: PrimaryAsyncButton( - text: "claim_your_gift".tr(), - enabled: token != null, - onTap: () async { - if (token == null) return; - try { - final response = await _airdropService - .claimRequestGift(token); - final series = await _feralFileService - .getSeries(response.seriesID); - if (!mounted) return; - Navigator.of(context).pushNamed( - AppRouter.claimAirdropPage, - arguments: ClaimTokenPagePayload( - claimID: response.claimID, - series: series, - shareCode: '')); - } catch (e) { - log.info("Claim your gift tap ${e.toString()}"); - } - }, - ), - ); - }) - : null, + listBottomWidget: + (widget.payload.announcement?.isMemento6 == true) + ? FutureBuilder( + future: _airdropService + // ignore: discarded_futures + .getTokenByContract(momaMementoContractAddresses), + builder: (context, snapshot) { + final token = snapshot.data as AssetToken?; + return Padding( + padding: const EdgeInsets.only( + left: 18, right: 18, bottom: 15), + child: PrimaryAsyncButton( + text: 'claim_your_gift'.tr(), + enabled: token != null, + onTap: () async { + if (token == null) { + return; + } + try { + final response = await _airdropService + .claimRequestGift(token); + final series = await _feralFileService + .getSeries(response.seriesID); + if (!mounted) { + return; + } + unawaited(Navigator.of(context).pushNamed( + AppRouter.claimAirdropPage, + arguments: ClaimTokenPagePayload( + claimID: response.claimID, + series: series, + shareCode: ''))); + } catch (e) { + log.info('Claim your gift tap $e'); + } + }, + ), + ); + }) + : null, customBottomWidget: !isCustomerSupportAvailable ? const SizedBox() - : _isRated == false && _status == 'closed' + : !_isRated && _status == 'closed' ? MyRatingBar( submit: (String messageType, DraftCustomerSupportData data, {bool isRating = false}) => + // ignore: discarded_futures _submit(messageType, data, isRating: isRating)) : Column( children: [ @@ -433,25 +440,24 @@ class _SupportThreadPageState extends State ))); } - InputOptions _inputOption() { - return InputOptions( - sendButtonVisibilityMode: SendButtonVisibilityMode.always, - onTextChanged: (text) { - if (_sendIcon == "assets/images/sendMessageFilled.svg" && - text.trim() == '' || - _sendIcon == "assets/images/sendMessage.svg" && - text.trim() != '') { - setState(() { - _sendIcon = text.trim() != '' - ? "assets/images/sendMessageFilled.svg" - : "assets/images/sendMessage.svg"; - }); - } - }); - } + InputOptions _inputOption() => InputOptions( + sendButtonVisibilityMode: SendButtonVisibilityMode.always, + onTextChanged: (text) { + if (_sendIcon == 'assets/images/sendMessageFilled.svg' && + text.trim() == '' || + _sendIcon == 'assets/images/sendMessage.svg' && text.trim() != '') { + setState(() { + _sendIcon = text.trim() != '' + ? 'assets/images/sendMessageFilled.svg' + : 'assets/images/sendMessage.svg'; + }); + } + }); Widget debugLogView() { - if (_debugLog == null) return const SizedBox(); + if (_debugLog == null) { + return const SizedBox(); + } final debugLog = _debugLog!; final theme = Theme.of(context); final fileSize = debugLog.second.length; @@ -462,13 +468,13 @@ class _SupportThreadPageState extends State child: Row( children: [ Text( - debugLog.first.split("_").last, + debugLog.first.split('_').last, style: theme.primaryTextTheme.ppMori400White14 - .copyWith(color: AppColor.auSuperTeal), + .copyWith(color: AppColor.feralFileHighlight), ), const SizedBox(width: 5), Text( - "(${fileSizeInMB.toStringAsFixed(2)} MB)", + '(${fileSizeInMB.toStringAsFixed(2)} MB)', style: theme.primaryTextTheme.ppMori400White14 .copyWith(color: AppColor.auQuickSilver), ), @@ -481,7 +487,7 @@ class _SupportThreadPageState extends State }); }, child: SvgPicture.asset( - "assets/images/iconClose.svg", + 'assets/images/iconClose.svg', width: 20, height: 20, colorFilter: @@ -495,8 +501,10 @@ class _SupportThreadPageState extends State bool _isRatingMessage(types.Message message) { if (message is types.CustomMessage) { - if (message.metadata?["rating"] == null) return false; - if (message.metadata?["rating"] > 0) { + if (message.metadata?['rating'] == null) { + return false; + } + if (message.metadata?['rating'] > 0) { return true; } } @@ -512,14 +520,20 @@ class _SupportThreadPageState extends State int _firstRatingIndex(List messages) { for (int i = 0; i < messages.length; i++) { - if (_isRatingMessage(messages[i])) return i; - if (_isCustomerSupportMessage(messages[i]) == false) return -1; + if (_isRatingMessage(messages[i])) { + return i; + } + if (!_isCustomerSupportMessage(messages[i])) { + return -1; + } } return -1; } Widget _ratingBar(int rating) { - if (rating == 0) return const SizedBox(); + if (rating == 0) { + return const SizedBox(); + } return RatingBar.builder( initialRating: rating.toDouble(), minRating: 1, @@ -542,14 +556,14 @@ class _SupportThreadPageState extends State }) { final theme = Theme.of(context); var color = _user.id != message.author.id - ? AppColor.auSuperTeal + ? AppColor.feralFileHighlight : AppColor.primaryBlack; if (message.type == types.MessageType.image) { color = Colors.transparent; } bool isError = false; - String uuid = ""; + String uuid = ''; if (message is types.Message) { if (message.status == types.Status.error) { isError = true; @@ -595,13 +609,13 @@ class _SupportThreadPageState extends State }); }, child: Text( - "retry".tr(), + 'retry'.tr(), style: theme.textTheme.ppMori400Black12 .copyWith(decoration: TextDecoration.underline), ), ), Text( - "・", + '・', style: theme.textTheme.ppMori400Black12, ), GestureDetector( @@ -610,19 +624,21 @@ class _SupportThreadPageState extends State isDelete: true); await _loadDrafts(); if (_draftMessages.isEmpty && _messages.isEmpty) { - if (!mounted) return; + if (!mounted) { + return; + } Navigator.of(context).pop(); } }, child: Text( - "delete".tr(), + 'delete'.tr(), style: theme.textTheme.ppMori400Black12 .copyWith(decoration: TextDecoration.underline), ), ), const SizedBox(width: 6), Text( - "failed_to_send".tr(), + 'failed_to_send'.tr(), style: theme.textTheme.ppMori400Black12 .copyWith(color: orangeRust), ), @@ -646,15 +662,15 @@ class _SupportThreadPageState extends State Widget _customMessageBuilder(types.CustomMessage message, {required int messageWidth}) { final theme = Theme.of(context); - switch (message.metadata?["status"]) { - case "resolved": + switch (message.metadata?['status']) { + case 'resolved': return Container( padding: const EdgeInsets.symmetric(vertical: 14), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "issue_resolved_".tr(), + 'issue_resolved_'.tr(), textAlign: TextAlign.start, style: ResponsiveLayout.isMobile ? theme.textTheme.ppMori700Black14 @@ -662,7 +678,7 @@ class _SupportThreadPageState extends State ), const SizedBox(height: 10), Text( - "our_team_thank".tr(), + 'our_team_thank'.tr(), textAlign: TextAlign.start, style: ResponsiveLayout.isMobile ? theme.textTheme.ppMori400Black14 @@ -671,15 +687,15 @@ class _SupportThreadPageState extends State const SizedBox(height: 20), TextButton( onPressed: () { - if (_status == "close") { + if (_status == 'close') { setState(() { - _status = "clickToReopen"; + _status = 'clickToReopen'; }); } }, style: theme.textButtonNoPadding, child: Text( - "still_problem".tr(), + 'still_problem'.tr(), //"Still experiencing the same problem?", style: ResponsiveLayout.isMobile ? theme.textTheme.linkStyle14 @@ -690,21 +706,21 @@ class _SupportThreadPageState extends State ), ]), ); - case "rating": + case 'rating': return Container( padding: const EdgeInsets.symmetric(vertical: 14), color: AppColor.primaryBlack, - child: _ratingBar(message.metadata?["rating"]), + child: _ratingBar(message.metadata?['rating']), ); - case "careToShare": - case "rateIssue": + case 'careToShare': + case 'rateIssue': return Container( padding: const EdgeInsets.symmetric(vertical: 14), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - message.metadata?["content"], + message.metadata?['content'], textAlign: TextAlign.start, style: ResponsiveLayout.isMobile ? theme.textTheme.ppMori700Black14 @@ -712,10 +728,10 @@ class _SupportThreadPageState extends State ), ]), ); - case "announcement": + case 'announcement': return Container( padding: const EdgeInsets.symmetric(vertical: 14), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ if (widget.payload.announcement!.title.isNotEmpty) ...[ @@ -743,7 +759,9 @@ class _SupportThreadPageState extends State } void _loadIssueDetails() async { - if (_issueID == null) return; + if (_issueID == null) { + return; + } final issueDetails = await _customerSupportService.getDetails(_issueID!); if (widget.payload.announcement != null && issueDetails.issue.unread > 0) { _callMixpanelReadAnnouncementEvent(widget.payload.announcement!); @@ -756,14 +774,14 @@ class _SupportThreadPageState extends State if (mounted) { setState(() { - String lastMessage = ""; + String lastMessage = ''; if (issueDetails.messages.isNotEmpty) { lastMessage = issueDetails.messages[0].message; } _status = issueDetails.issue.status; _isRated = issueDetails.issue.rating > 0 && - issueDetails.issue.status == "closed" && + issueDetails.issue.status == 'closed' && (lastMessage.contains(RATING_MESSAGE_START) || lastMessage.contains(STAR_RATING)); _reportIssueType = issueDetails.issue.reportIssueType; @@ -773,13 +791,17 @@ class _SupportThreadPageState extends State } bool _isRating(types.Message message) { - final rating = message.metadata?["rating"]; - if (rating != null && rating != "" && rating > 0 && rating < 6) return true; + final rating = message.metadata?['rating']; + if (rating != null && rating != '' && rating > 0 && rating < 6) { + return true; + } return false; } Future _loadDrafts() async { - if (_issueID == null) return; + if (_issueID == null) { + return; + } final drafts = await _customerSupportService.getDrafts(_issueID!); final draftMessages = (await Future.wait(drafts.map((e) => _convertChatMessage(e, null)))) @@ -794,8 +816,12 @@ class _SupportThreadPageState extends State void _loadCustomerSupportUpdates() async { final update = _customerSupportService.customerSupportUpdate.value; - if (update == null) return; - if (update.draft.issueID != _issueID) return; + if (update == null) { + return; + } + if (update.draft.issueID != _issueID) { + return; + } _issueID = update.response.issueID; memoryValues.viewingSupportThreadIssueID = _issueID; @@ -815,20 +841,20 @@ class _SupportThreadPageState extends State List mutedMessages = []; if (_issueID == null) { messageType = CSMessageType.CreateIssue.rawValue; - _issueID = "TEMP-${const Uuid().v4()}"; + _issueID = 'TEMP-${const Uuid().v4()}'; final payload = widget.payload; if (payload.announcement != null) { final metricClient = injector.get(); final announcement = payload.announcement!; - metricClient.addEvent( + unawaited(metricClient.addEvent( MixpanelEvent.replyAnnouncement, data: { - "id": announcement.announcementContextId, - "type": announcement.type, - "title": announcement.title, + 'id': announcement.announcementContextId, + 'type': announcement.type, + 'title': announcement.title, }, - ); + )); data.announcementId = announcement.announcementContextId; } @@ -836,11 +862,11 @@ class _SupportThreadPageState extends State final sentryID = payload.sentryID; if (sentryID.isNotEmpty) { mutedMessages.add( - "[SENTRY REPORT $sentryID](https://sentry.io/organizations/bitmark-inc/issues/?query=$sentryID)"); + '[SENTRY REPORT $sentryID](https://sentry.io/organizations/bitmark-inc/issues/?query=$sentryID)'); } if (payload.metadata.isNotEmpty) { - mutedMessages.add("METADATA EXCEPTION: ${payload.metadata}"); + mutedMessages.add('METADATA EXCEPTION: ${payload.metadata}'); } } } @@ -849,9 +875,9 @@ class _SupportThreadPageState extends State } if (messageType == CSMessageType.PostMessage.rawValue && - _isRated == true && - _status == "closed") { - data.text = "$RATING_MESSAGE_START${data.text}"; + _isRated && + _status == 'closed') { + data.text = '$RATING_MESSAGE_START${data.text}'; } final draft = DraftCustomerSupport( @@ -861,31 +887,33 @@ class _SupportThreadPageState extends State data: json.encode(data), createdAt: DateTime.now(), reportIssueType: _reportIssueType, - mutedMessages: mutedMessages.join("[SEPARATOR]"), + mutedMessages: mutedMessages.join('[SEPARATOR]'), ); _draftMessages.insertAll(0, await _convertChatMessage(draft, null)); if (_issueID != null && _status == 'clickToReopen') { setState(() { - _status = "reopening"; + _status = 'reopening'; }); await _customerSupportService.reopen(_issueID!); - _status = "open"; + _status = 'open'; _isRated = false; } await _customerSupportService.draftMessage(draft); if (isRating) { - final rating = getRating(data.text ?? ""); + final rating = getRating(data.text ?? ''); if (rating > 0) { await _customerSupportService.rateIssue(_issueID!, rating); } } setState(() { - _sendIcon = "assets/images/sendMessage.svg"; + _sendIcon = 'assets/images/sendMessage.svg'; _forceAccountsViewRedraw = Object(); - if (isRating) _isRated = true; + if (isRating) { + _isRated = true; + } }); Future.delayed(const Duration(seconds: 5), () { @@ -893,11 +921,11 @@ class _SupportThreadPageState extends State }); } - void _handleSendPressed(types.PartialText message) async { + Future _handleSendPressed(types.PartialText message) async { if (_isFileAttached) { - _addAppLogs(message); + await _addAppLogs(message); } else { - _submit( + await _submit( CSMessageType.PostMessage.rawValue, DraftCustomerSupportData( text: message.text, @@ -907,7 +935,9 @@ class _SupportThreadPageState extends State } Future _addAppLogs(types.PartialText message) async { - if (_debugLog == null) return; + if (_debugLog == null) { + return; + } final filename = _debugLog!.first; final combinedBytes = _debugLog!.second; @@ -931,9 +961,9 @@ class _SupportThreadPageState extends State if (_isFileAttached) { return; } - UIHelper.showDialog( + unawaited(UIHelper.showDialog( context, - "attach_file".tr(), + 'attach_file'.tr(), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -948,30 +978,30 @@ class _SupportThreadPageState extends State height: 10, ), PrimaryButton( - onTap: () { - _addDebugLog(); + onTap: () async { + await _addDebugLog(); }, text: 'debug_log'.tr(), ), const SizedBox(height: 10), OutlineButton( onTap: () => Navigator.of(context).pop(), - text: "cancel_dialog".tr(), + text: 'cancel_dialog'.tr(), ), const SizedBox(height: 15), ], ), isDismissible: true, - ); + )); } - void _handleImageSelection() async { + Future _handleImageSelection() async { log_util.log.info('[_handleImageSelection] begin'); final result = await ImagePicker().pickMultiImage(); final attachments = await Future.wait(result.map((element) async { final bytes = await element.readAsBytes(); - final fileName = "${bytes.length}_${element.name}"; + final fileName = '${bytes.length}_${element.name}'; final localPath = await _customerSupportService.storeFile(fileName, bytes); return LocalAttachment(path: localPath, fileName: fileName); @@ -987,7 +1017,7 @@ class _SupportThreadPageState extends State } Future> _convertChatMessage( - dynamic message, String? tempID) async { + message, String? tempID) async { String id; types.User author; types.Status status; @@ -996,14 +1026,14 @@ class _SupportThreadPageState extends State int rating = 0; Map metadata = {}; if (message is app.Message) { - id = tempID ?? "${message.id}"; - author = message.from.contains("did:key") ? _user : _bitmark; + id = tempID ?? '${message.id}'; + author = message.from.contains('did:key') ? _user : _bitmark; status = types.Status.delivered; createdAt = message.timestamp; text = message.filteredMessage; rating = getRating(text); if (rating > 0) { - metadata = {"rating": rating}; + metadata = {'rating': rating}; } // } else if (message is DraftCustomerSupport) { @@ -1018,7 +1048,7 @@ class _SupportThreadPageState extends State metadata = json.decode(message.data); rating = message.draftData.rating; if (rating > 0) { - metadata["rating"] = rating; + metadata['rating'] = rating; } // } else { @@ -1047,7 +1077,7 @@ class _SupportThreadPageState extends State if (message is app.Message) { for (var attachment in message.attachments) { titles.add(attachment.title); - uris.add("$storedDirectory/${attachment.title}"); + uris.add('$storedDirectory/${attachment.title}'); contentTypes.add(attachment.contentType); } // @@ -1062,7 +1092,7 @@ class _SupportThreadPageState extends State } for (var i = 0; i < titles.length; i += 1) { - if (contentTypes[i].contains("image")) { + if (contentTypes[i].contains('image')) { result.add(types.ImageMessage( id: '$id${titles[i]}', author: author, @@ -1096,7 +1126,7 @@ class _SupportThreadPageState extends State int getRating(String text) { if (text.startsWith(STAR_RATING)) { - final rating = int.tryParse(text.replacePrefix(STAR_RATING, "")); + final rating = int.tryParse(text.replacePrefix(STAR_RATING, '')); if (rating != null && rating > 0 && rating <= 5) { return rating; } @@ -1120,7 +1150,7 @@ class _SupportThreadPageState extends State inputTextStyle: theme.textTheme.ppMori400White14, inputTextColor: theme.colorScheme.secondary, attachmentButtonIcon: SvgPicture.asset( - "assets/images/joinFile.svg", + 'assets/images/joinFile.svg', colorFilter: ColorFilter.mode( _isFileAttached ? AppColor.disabledColor @@ -1149,7 +1179,7 @@ class _SupportThreadPageState extends State receivedMessageDocumentIconColor: Colors.transparent, sentMessageDocumentIconColor: Colors.transparent, documentIcon: SvgPicture.asset( - "assets/images/bug_icon.svg", + 'assets/images/bug_icon.svg', width: 20, ), sentMessageCaptionTextStyle: ResponsiveLayout.isMobile @@ -1172,7 +1202,8 @@ class _SupportThreadPageState extends State } class MyRatingBar extends StatefulWidget { - const MyRatingBar({Key? key, required this.submit}) : super(key: key); + const MyRatingBar({required this.submit, super.key}); + final Future Function( String messageType, DraftCustomerSupportData data, {bool isRating}) submit; @@ -1182,56 +1213,58 @@ class MyRatingBar extends StatefulWidget { } class _MyRatingBarState extends State { - String customerRating = ""; + String customerRating = ''; int ratingInt = 0; - Widget sendButtonRating = SvgPicture.asset("assets/images/sendMessage.svg"); + Widget sendButtonRating = SvgPicture.asset('assets/images/sendMessage.svg'); @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 30), - color: AppColor.primaryBlack, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - RatingBar.builder( - minRating: 1, - itemSize: 24, - itemPadding: const EdgeInsets.symmetric(horizontal: 10.0), - itemBuilder: (context, _) => const Icon( - Icons.star, - color: AppColor.white, + Widget build(BuildContext context) => Container( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 30), + color: AppColor.primaryBlack, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + RatingBar.builder( + minRating: 1, + itemSize: 24, + itemPadding: const EdgeInsets.symmetric(horizontal: 10.0), + itemBuilder: (context, _) => const Icon( + Icons.star, + color: AppColor.white, + ), + unratedColor: AppColor.chatSecondaryColor, + onRatingUpdate: _updateRating, ), - unratedColor: AppColor.chatSecondaryColor, - onRatingUpdate: _updateRating, - ), - const SizedBox(width: 40), - IconButton(onPressed: _sendButtonOnPress, icon: sendButtonRating), - const SizedBox(width: 10) - ], - ), - ); - } + const SizedBox(width: 40), + IconButton(onPressed: _sendButtonOnPress, icon: sendButtonRating), + const SizedBox(width: 10) + ], + ), + ); - _updateRating(double rating) { + void _updateRating(double rating) { ratingInt = rating.toInt(); customerRating = _convertRatingToText(ratingInt); setState(() { sendButtonRating = - SvgPicture.asset("assets/images/sendMessageFilled.svg"); + SvgPicture.asset('assets/images/sendMessageFilled.svg'); }); } - _sendButtonOnPress() async { - if (ratingInt < 1) return; - widget.submit(CSMessageType.PostMessage.rawValue, + Future _sendButtonOnPress() async { + if (ratingInt < 1) { + return; + } + await widget.submit(CSMessageType.PostMessage.rawValue, DraftCustomerSupportData(text: customerRating, rating: ratingInt), isRating: true); } String _convertRatingToText(int rating) { - if (rating > 0) return "$STAR_RATING${rating.toString()}"; + if (rating > 0) { + return '$STAR_RATING$rating'; + } - return ""; + return ''; } } diff --git a/lib/screen/detail/preview/artwork_preview_page.dart b/lib/screen/detail/preview/artwork_preview_page.dart index 7aba3c1aa..2545d32d7 100644 --- a/lib/screen/detail/preview/artwork_preview_page.dart +++ b/lib/screen/detail/preview/artwork_preview_page.dart @@ -101,7 +101,9 @@ class _ArtworkPreviewPageState extends State final defaultDuration = playControl!.timer == 0 ? time ?? 10 : playControl!.timer; _timer = Timer.periodic(Duration(seconds: defaultDuration), (timer) { - if (!(_timer?.isActive ?? false)) return; + if (!(_timer?.isActive ?? false)) { + return; + } if (controller.page?.toInt() == tokens.length - 1) { controller.jumpTo(0); } else { @@ -168,13 +170,15 @@ class _ArtworkPreviewPageState extends State } Future _moveToInfo(AssetToken? assetToken) async { - if (assetToken == null) return; - metricClient.addEvent( + if (assetToken == null) { + return; + } + unawaited(metricClient.addEvent( MixpanelEvent.clickArtworkInfo, data: { - "id": assetToken.id, + 'id': assetToken.id, }, - ); + )); keyboardManagerKey.currentState?.hideKeyboard(); final currentIndex = tokens.indexWhere((element) => @@ -203,7 +207,7 @@ class _ArtworkPreviewPageState extends State metricClient.addEvent( MixpanelEvent.seeArtworkFullScreen, data: { - "id": assetToken?.id, + 'id': assetToken?.id, }, ); _bloc.add(ChangeFullScreen(isFullscreen: true)); @@ -214,7 +218,7 @@ class _ArtworkPreviewPageState extends State content: Container( padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 10), decoration: BoxDecoration( - color: theme.auSuperTeal.withOpacity(0.9), + color: AppColor.feralFileHighlight.withOpacity(0.9), borderRadius: BorderRadius.circular(64), ), child: Text( @@ -236,7 +240,7 @@ class _ArtworkPreviewPageState extends State BlocProvider.value( value: _canvasDeviceBloc, child: CanvasDeviceView( - sceneId: assetToken?.id ?? "", + sceneId: assetToken?.id ?? '', onClose: () { Navigator.of(context).pop(); }, @@ -244,7 +248,7 @@ class _ArtworkPreviewPageState extends State ), isDismissible: true, ); - _fetchDevice(assetToken?.id ?? ""); + _fetchDevice(assetToken?.id ?? ''); } @override @@ -258,15 +262,15 @@ class _ArtworkPreviewPageState extends State assetToken = state.assetToken; isFullScreen = state.isFullScreen; } - final hasKeyboard = assetToken?.medium == "software" || - assetToken?.medium == "other" || + final hasKeyboard = assetToken?.medium == 'software' || + assetToken?.medium == 'other' || assetToken?.medium == null; final hideArtist = assetToken?.isPostcard ?? false; final identityState = context.watch().state; final artistName = assetToken?.artistName?.toIdentityOrMask(identityState.identityMap); - _fetchDevice(assetToken?.id ?? ""); - var subTitle = ""; + _fetchDevice(assetToken?.id ?? ''); + var subTitle = ''; if (artistName != null && artistName.isNotEmpty) { subTitle = artistName; } @@ -322,35 +326,34 @@ class _ArtworkPreviewPageState extends State }, controller: controller, itemCount: tokens.length, - itemBuilder: (context, index) { - return BlocBuilder( - bloc: _canvasDeviceBloc, - builder: (context, state) { - final isCasting = state.isCasting; - if (isCasting) { - return const Center( - child: CurrentlyCastingArtwork(), - ); - } - if (tokens[index].id.isPostcardId) { - return PostcardPreviewWidget( - identity: tokens[index], - useIndexer: widget.payload.useIndexer, - ); - } - return ArtworkPreviewWidget( + itemBuilder: (context, index) => + BlocBuilder( + bloc: _canvasDeviceBloc, + builder: (context, state) { + final isCasting = state.isCasting; + if (isCasting) { + return const Center( + child: CurrentlyCastingArtwork(), + ); + } + if (tokens[index].id.isPostcardId) { + return PostcardPreviewWidget( identity: tokens[index], - onLoaded: ( - {InAppWebViewController? webViewController, - int? time}) { - setTimer(time: time); - }, - focusNode: _focusNode, useIndexer: widget.payload.useIndexer, ); - }, - ); - }, + } + return ArtworkPreviewWidget( + identity: tokens[index], + onLoaded: ( + {InAppWebViewController? webViewController, + int? time}) { + setTimer(time: time); + }, + focusNode: _focusNode, + useIndexer: widget.payload.useIndexer, + ); + }, + ), ), ), Visibility( @@ -376,10 +379,10 @@ class _ArtworkPreviewPageState extends State width: 20, ), Visibility( - visible: (assetToken?.medium == 'software' || + visible: assetToken?.medium == 'software' || assetToken?.medium == 'other' || (assetToken?.medium?.isEmpty ?? true) || - isCasting), + isCasting, child: KeyboardManagerWidget( key: keyboardManagerKey, focusNode: _focusNode, @@ -410,7 +413,7 @@ class _ArtworkPreviewPageState extends State ? null : () => onClickFullScreen(assetToken), child: Semantics( - label: "fullscreen_icon", + label: 'fullscreen_icon', child: SvgPicture.asset( 'assets/images/fullscreen_icon.svg', colorFilter: ColorFilter.mode( @@ -500,13 +503,11 @@ class KeyboardManagerWidgetState extends State { } @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - _isShowKeyboard ? hideKeyboard : showKeyboard; - widget.onTap?.call(); - }, - child: SvgPicture.asset('assets/images/keyboard_icon.svg'), - ); - } + Widget build(BuildContext context) => GestureDetector( + onTap: () { + _isShowKeyboard ? hideKeyboard : showKeyboard; + widget.onTap?.call(); + }, + child: SvgPicture.asset('assets/images/keyboard_icon.svg'), + ); } diff --git a/lib/screen/detail/preview_primer.dart b/lib/screen/detail/preview_primer.dart index f45d28975..f18b842d2 100644 --- a/lib/screen/detail/preview_primer.dart +++ b/lib/screen/detail/preview_primer.dart @@ -96,7 +96,7 @@ class _PreviewPrimerPageState extends State content: Container( padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 10), decoration: BoxDecoration( - color: theme.auSuperTeal.withOpacity(0.9), + color: AppColor.feralFileHighlight.withOpacity(0.9), borderRadius: BorderRadius.circular(64), ), child: Text( diff --git a/lib/screen/home/home_navigation_page.dart b/lib/screen/home/home_navigation_page.dart index 547a865b9..5b405763f 100644 --- a/lib/screen/home/home_navigation_page.dart +++ b/lib/screen/home/home_navigation_page.dart @@ -463,7 +463,7 @@ class _HomeNavigationPageState extends State addOnTextSpan: [ TextSpan( text: 'tap_to_view'.tr(), - style: Theme.of(context).textTheme.ppMori400Green14), + style: Theme.of(context).textTheme.ppMori400FFYellow14), ], openHandler: () async { final announcementID = '${data["id"]}'; unawaited(_openAnnouncement(announcementID)); @@ -664,7 +664,7 @@ class _HomeNavigationPageState extends State addOnTextSpan: [ TextSpan( text: 'tap_to_view'.tr(), - style: Theme.of(context).textTheme.ppMori400Green14), + style: Theme.of(context).textTheme.ppMori400FFYellow14), ], openHandler: () async { final announcementID = announcement.announcementContextId; unawaited(_openAnnouncement(announcementID)); diff --git a/lib/screen/migration/key_sync_page.dart b/lib/screen/migration/key_sync_page.dart index fe9a5b4b5..099297784 100644 --- a/lib/screen/migration/key_sync_page.dart +++ b/lib/screen/migration/key_sync_page.dart @@ -39,7 +39,7 @@ class KeySyncPage extends StatelessWidget { return Scaffold( appBar: getBackAppBar( context, - title: "conflict_detected".tr(), + title: 'conflict_detected'.tr(), onBack: () { if (state.isProcessing != true) { Navigator.of(context).pop(); @@ -57,34 +57,33 @@ class KeySyncPage extends StatelessWidget { children: [ addTitleSpace(), Text( - "conflict_keychains".tr(), + 'conflict_keychains'.tr(), //"We have detected a conflict of keychains.", style: theme.textTheme.ppMori700Black14, ), const SizedBox(height: 12), Text( - "this_might_occur".tr(), - //"This might occur if you have signed in to a different cloud on this device. You are required to define a default keychain for identification before continuing with other actions inside the app:", + 'this_might_occur'.tr(), style: theme.textTheme.ppMori400Black14, ), const SizedBox(height: 20), Text( - "select_your_default_keychain".tr(), + 'select_your_default_keychain'.tr(), style: theme.textTheme.ppMori400Black14, ), const SizedBox(height: 12), Container( - padding: const EdgeInsets.all(20.0), + padding: const EdgeInsets.all(20), decoration: BoxDecoration( border: Border.all( color: theme.colorScheme.primary), - borderRadius: const BorderRadius.all( - Radius.circular(5.0))), + borderRadius: + const BorderRadius.all(Radius.circular(5))), child: GestureDetector( onTap: () { UIHelper.showDialog( context, - "select_wallet_type".tr(), + 'select_wallet_type'.tr(), SelectKeychainView( onSelect: (bool isLocal) { bloc.add(ToggleKeySyncEvent()); @@ -123,12 +122,12 @@ class KeySyncPage extends StatelessWidget { ), ), )), - const SizedBox(height: 40.0), + const SizedBox(height: 40), Container( padding: const EdgeInsets.all(15), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -141,8 +140,7 @@ class KeySyncPage extends StatelessWidget { ), const SizedBox(height: 12), Text( - "data_contain".tr(), - //"All the data contained in the other keychain will be imported into the defined default one and converted into a full account. If you were using it as the main wallet, you will be able to continue to do so after the conversion. No keys are lost.", + 'data_contain'.tr(), style: ResponsiveLayout.isMobile ? theme.textTheme.ppMori400Black14 : theme.textTheme.ppMori400Black16, @@ -158,7 +156,7 @@ class KeySyncPage extends StatelessWidget { MaterialTapTargetSize.shrinkWrap, ), child: Text( - "learn_security".tr(), + 'learn_security'.tr(), style: (ResponsiveLayout.isMobile ? theme.textTheme.ppMori400Black14 : theme.textTheme.ppMori400Black16) @@ -177,7 +175,7 @@ class KeySyncPage extends StatelessWidget { children: [ Expanded( child: PrimaryButton( - text: "proceed".tr(), + text: 'proceed'.tr(), isProcessing: state.isProcessing == true, onTap: state.isProcessing == true ? null @@ -203,11 +201,12 @@ class SelectKeychainView extends StatefulWidget { final Function(bool isLocal) onSelect; final Function(bool isLocal) onChange; final bool defaultOption; + const SelectKeychainView( - {super.key, - required this.onSelect, + {required this.onSelect, required this.onChange, - required this.defaultOption}); + required this.defaultOption, + super.key}); @override State createState() => SelectKeychainViewState(); @@ -215,6 +214,7 @@ class SelectKeychainView extends StatefulWidget { class SelectKeychainViewState extends State { late bool _selectedOption; + @override void initState() { _selectedOption = widget.defaultOption; @@ -222,41 +222,39 @@ class SelectKeychainViewState extends State { } @override - Widget build(BuildContext context) { - return Column( - children: [ - _option( - context, - true, - ), - addDivider(height: 40, color: AppColor.white), - _option( - context, - false, - ), - const SizedBox(height: 40), - Padding( - padding: ResponsiveLayout.pageHorizontalEdgeInsets, - child: Column( - children: [ - PrimaryButton( - text: "select".tr(), - onTap: () { - widget.onSelect(_selectedOption); - Navigator.of(context).pop(); - }, - ), - const SizedBox(height: 10), - OutlineButton( - onTap: () => Navigator.of(context).pop(), - text: "cancel".tr(), - ), - ], + Widget build(BuildContext context) => Column( + children: [ + _option( + context, + true, ), - ) - ], - ); - } + addDivider(height: 40, color: AppColor.white), + _option( + context, + false, + ), + const SizedBox(height: 40), + Padding( + padding: ResponsiveLayout.pageHorizontalEdgeInsets, + child: Column( + children: [ + PrimaryButton( + text: 'select'.tr(), + onTap: () { + widget.onSelect(_selectedOption); + Navigator.of(context).pop(); + }, + ), + const SizedBox(height: 10), + OutlineButton( + onTap: () => Navigator.of(context).pop(), + text: 'cancel'.tr(), + ), + ], + ), + ) + ], + ); Widget _option( BuildContext context, @@ -272,7 +270,7 @@ class SelectKeychainViewState extends State { _selectedOption = option; }); }, - child: Container( + child: DecoratedBox( decoration: const BoxDecoration(color: Colors.transparent), child: Row( children: [ diff --git a/lib/screen/participate_user_test_page.dart b/lib/screen/participate_user_test_page.dart index 9a597b26b..08aafbb11 100644 --- a/lib/screen/participate_user_test_page.dart +++ b/lib/screen/participate_user_test_page.dart @@ -58,7 +58,7 @@ class ParticipateUserTestPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/screen/playlists/edit_playlist/edit_playlist.dart b/lib/screen/playlists/edit_playlist/edit_playlist.dart index b8a9572da..4c0eb4d1d 100644 --- a/lib/screen/playlists/edit_playlist/edit_playlist.dart +++ b/lib/screen/playlists/edit_playlist/edit_playlist.dart @@ -371,7 +371,7 @@ class _EditPlaylistScreenState extends State { }, width: 170, text: tr('remove').capitalize(), - color: theme.auSuperTeal, + color: AppColor.feralFileHighlight, ), ], ), diff --git a/lib/screen/playlists/list_playlists/list_playlists.dart b/lib/screen/playlists/list_playlists/list_playlists.dart index 0b47ac224..7cb71343f 100644 --- a/lib/screen/playlists/list_playlists/list_playlists.dart +++ b/lib/screen/playlists/list_playlists/list_playlists.dart @@ -135,7 +135,9 @@ class _PlaylistItemState extends State { decoration: BoxDecoration( color: AppColor.white, border: Border.all( - color: widget.onHold ? theme.auSuperTeal : Colors.transparent, + color: widget.onHold + ? AppColor.feralFileHighlight + : Colors.transparent, width: widget.onHold ? 2 : 0, ), borderRadius: BorderRadius.circular(5), diff --git a/lib/screen/playlists/view_playlist/view_playlist.dart b/lib/screen/playlists/view_playlist/view_playlist.dart index 93e49c7d8..c4b4f662c 100644 --- a/lib/screen/playlists/view_playlist/view_playlist.dart +++ b/lib/screen/playlists/view_playlist/view_playlist.dart @@ -166,7 +166,7 @@ class _ViewPlaylistScreenState extends State { isScrollControlled: true, builder: (context) => StatefulBuilder( builder: (context, setState) => Container( - color: theme.auSuperTeal, + color: AppColor.feralFileHighlight, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/screen/release_notes_page.dart b/lib/screen/release_notes_page.dart index c3a2cbf5a..99a37e597 100644 --- a/lib/screen/release_notes_page.dart +++ b/lib/screen/release_notes_page.dart @@ -22,8 +22,7 @@ import 'package:url_launcher/url_launcher_string.dart'; class ReleaseNotesPage extends StatefulWidget { final String releaseNotes; - const ReleaseNotesPage({required this.releaseNotes, Key? key}) - : super(key: key); + const ReleaseNotesPage({required this.releaseNotes, super.key}); @override State createState() => _ReleaseNotesPageState(); @@ -43,7 +42,7 @@ class _ReleaseNotesPageState extends State { return Scaffold( appBar: getBackAppBar( context, - title: "release_notes".tr(), + title: 'release_notes'.tr(), onBack: () => Navigator.of(context).pop(), ), body: Container( @@ -58,32 +57,32 @@ class _ReleaseNotesPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const SizedBox(height: 60.0), + const SizedBox(height: 60), Text( - "believe_transparency".tr(), + 'believe_transparency'.tr(), style: theme.textTheme.ppMori700Black16, ), Row( children: [ Text( - "autonomy_is_".tr(), + 'autonomy_is_'.tr(), style: theme.textTheme.ppMori400Black16, ), GestureDetector( child: Text( - "open_source".tr(), + 'open_source'.tr(), style: theme.textTheme.ppMori400Black16 .copyWith(decoration: TextDecoration.underline), ), - onTap: () => launchUrl( + onTap: () async => launchUrl( Uri.parse(AUTONOMY_CLIENT_GITHUB_LINK), mode: LaunchMode.externalApplication), ), ], ), - const SizedBox(height: 30.0), - Divider( - color: theme.auSuperTeal, + const SizedBox(height: 30), + const Divider( + color: AppColor.feralFileHighlight, thickness: 1, ), Markdown( @@ -100,13 +99,15 @@ class _ReleaseNotesPageState extends State { TagBlockSyntax(), ], onTapLink: (text, href, title) async { - if (href == null) return; + if (href == null) { + return; + } if (DEEP_LINKS .any((prefix) => href.startsWith(prefix))) { injector() .handleDeeplink(href, delay: Duration.zero); } else if (await canLaunchUrlString(href)) { - launchUrlString(href, + await launchUrlString(href, mode: LaunchMode.externalApplication); } }, diff --git a/lib/screen/settings/crypto/wallet_detail/linked_wallet_detail_page.dart b/lib/screen/settings/crypto/wallet_detail/linked_wallet_detail_page.dart index 616e9fabe..265f3d921 100644 --- a/lib/screen/settings/crypto/wallet_detail/linked_wallet_detail_page.dart +++ b/lib/screen/settings/crypto/wallet_detail/linked_wallet_detail_page.dart @@ -430,7 +430,7 @@ class _LinkedWalletDetailPageState extends State child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: isCopied - ? AppColor.auSuperTeal + ? AppColor.feralFileHighlight : AppColor.auLightGrey, shadowColor: Colors.transparent, shape: RoundedRectangleBorder( diff --git a/lib/screen/settings/crypto/wallet_detail/wallet_detail_page.dart b/lib/screen/settings/crypto/wallet_detail/wallet_detail_page.dart index 0bca1b31d..159b6b9da 100644 --- a/lib/screen/settings/crypto/wallet_detail/wallet_detail_page.dart +++ b/lib/screen/settings/crypto/wallet_detail/wallet_detail_page.dart @@ -485,7 +485,7 @@ class _WalletDetailPageState extends State with RouteAware { child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: isCopied - ? AppColor.auSuperTeal + ? AppColor.feralFileHighlight : AppColor.auLightGrey, shadowColor: Colors.transparent, shape: RoundedRectangleBorder( diff --git a/lib/screen/wallet/wallet_page.dart b/lib/screen/wallet/wallet_page.dart index eaf84dbea..6a5943c5a 100644 --- a/lib/screen/wallet/wallet_page.dart +++ b/lib/screen/wallet/wallet_page.dart @@ -78,7 +78,7 @@ class _WalletPageState extends State void _showAddWalletOption() { final transparentTextTheme = Theme.of(context) .textTheme - .ppMori400Green14 + .ppMori400FFYellow14 .copyWith(color: Colors.transparent); final options = [ OptionItem( diff --git a/lib/screen/wallet_connect/wc_connect_page.dart b/lib/screen/wallet_connect/wc_connect_page.dart index cfac69639..ffffae1ed 100644 --- a/lib/screen/wallet_connect/wc_connect_page.dart +++ b/lib/screen/wallet_connect/wc_connect_page.dart @@ -165,7 +165,8 @@ class _WCConnectPageState extends State return; } - UIHelper.showLoadingScreen(context, text: 'connecting_wallet'.tr()); + unawaited( + UIHelper.showLoadingScreen(context, text: 'connecting_wallet'.tr())); late String payloadAddress; late CryptoType payloadType; switch (connectionRequest.runtimeType) { @@ -289,7 +290,7 @@ class _WCConnectPageState extends State addOnTextSpan: [ TextSpan( text: connectionRequest.name, - style: Theme.of(context).textTheme.ppMori400Green14, + style: Theme.of(context).textTheme.ppMori400FFYellow14, ) ], ); @@ -668,7 +669,7 @@ class _WCConnectPageState extends State ); Future _createAccount(BuildContext context) async { - UIHelper.showLoadingScreen(context, text: 'connecting'.tr()); + unawaited(UIHelper.showLoadingScreen(context, text: 'connecting'.tr())); final persona = await injector().getOrCreateDefaultPersona(); await persona.insertNextAddress(connectionRequest.isBeaconConnect diff --git a/lib/service/customer_support_service.dart b/lib/service/customer_support_service.dart index 8c42f42af..16045ceb9 100644 --- a/lib/service/customer_support_service.dart +++ b/lib/service/customer_support_service.dart @@ -5,6 +5,7 @@ // that can be found in the LICENSE file. // +import 'dart:async'; import 'dart:convert'; import 'dart:io'; @@ -19,6 +20,7 @@ import 'package:autonomy_flutter/model/customer_support.dart'; import 'package:autonomy_flutter/screen/app_router.dart'; import 'package:autonomy_flutter/screen/customer_support/support_thread_page.dart'; import 'package:autonomy_flutter/service/configuration_service.dart'; +import 'package:autonomy_flutter/service/metric_client_service.dart'; import 'package:autonomy_flutter/service/navigation_service.dart'; import 'package:autonomy_flutter/util/constants.dart'; import 'package:autonomy_flutter/util/device.dart'; @@ -33,8 +35,6 @@ import 'package:package_info_plus/package_info_plus.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -import 'metric_client_service.dart'; - class CustomerSupportUpdate { DraftCustomerSupport draft; PostedMessageResponse response; @@ -133,7 +133,9 @@ class CustomerSupportServiceImpl extends CustomerSupportService { (element) => element.reportIssueType == ReportIssueType.ReportNFTIssue); for (var draft in drafts) { - if (draft.type != CSMessageType.CreateIssue.rawValue) continue; + if (draft.type != CSMessageType.CreateIssue.rawValue) { + continue; + } final draftData = draft.draftData; @@ -174,9 +176,8 @@ class CustomerSupportServiceImpl extends CustomerSupportService { } @override - Future getDetails(String issueID) async { - return await _customerSupportApi.getDetails(issueID); - } + Future getDetails(String issueID) async => + await _customerSupportApi.getDetails(issueID); @override Future draftMessage(DraftCustomerSupport draft) async { @@ -225,29 +226,35 @@ class CustomerSupportServiceImpl extends CustomerSupportService { @override Future processMessages() async { log.info('[CS-Service][trigger] processMessages'); - if (_isProcessingDraftMessages) return; + if (_isProcessingDraftMessages) { + return; + } final fetchLimit = errorMessages.length + 1; log.info('[CS-Service][start] processMessages'); final draftMsgsRaw = await _draftCustomerSupportDao.fetchDrafts(fetchLimit); - if (draftMsgsRaw.isEmpty) return; + if (draftMsgsRaw.isEmpty) { + return; + } final draftMsg = draftMsgsRaw .firstWhereOrNull((element) => !errorMessages.contains(element.uuid)); - if (draftMsg == null) return; + if (draftMsg == null) { + return; + } log.info('[CS-Service][start] processMessages hasDraft'); _isProcessingDraftMessages = true; retryTime++; // Edge Case when database has not updated the new issueID for new comments - if (draftMsg.type != 'CreateIssue' && draftMsg.issueID.contains("TEMP")) { + if (draftMsg.type != 'CreateIssue' && draftMsg.issueID.contains('TEMP')) { final newIssueID = tempIssueIDMap[draftMsg.issueID]; if (newIssueID != null) { await _draftCustomerSupportDao.updateIssueID( draftMsg.issueID, newIssueID); } else { if (!draftMsgsRaw.any((element) => - ((element.issueID == draftMsg.issueID) && - (element.uuid != draftMsg.uuid)))) { + (element.issueID == draftMsg.issueID) && + (element.uuid != draftMsg.uuid))) { await _draftCustomerSupportDao.deleteDraft(draftMsg); } else { sendMessageFail(draftMsg.uuid); @@ -297,7 +304,7 @@ class CustomerSupportServiceImpl extends CustomerSupportService { data.text, sendAttachments, title: data.title, - mutedText: draftMsg.mutedMessages.split("[SEPARATOR]"), + mutedText: draftMsg.mutedMessages.split('[SEPARATOR]'), announcementID: data.announcementId, ); tempIssueIDMap[draftMsg.issueID] = result.issueID; @@ -339,9 +346,8 @@ class CustomerSupportServiceImpl extends CustomerSupportService { } @override - Future> getDrafts(String issueID) async { - return _draftCustomerSupportDao.getDrafts(issueID); - } + Future> getDrafts(String issueID) async => + _draftCustomerSupportDao.getDrafts(issueID); Future createIssue( String reportIssueType, @@ -359,27 +365,27 @@ class CustomerSupportServiceImpl extends CustomerSupportService { // add tags var tags = [reportIssueType]; if (Platform.isIOS) { - tags.add("iOS"); + tags.add('iOS'); } else if (Platform.isAndroid) { - tags.add("android"); + tags.add('android'); } // Muted Message - var mutedMessage = ""; + var mutedMessage = ''; final deviceID = await getDeviceID(); if (deviceID != null) { - mutedMessage += "**DeviceID**: $deviceID\n"; + mutedMessage += '**DeviceID**: $deviceID\n'; } final version = (await PackageInfo.fromPlatform()).version; - mutedMessage += "**Version**: $version\n"; + mutedMessage += '**Version**: $version\n'; final deviceInfo = await DeviceInfo.instance.getUserDeviceInfo(); - mutedMessage += "**DeviceName**: ${deviceInfo.machineName}\n"; - mutedMessage += "**OSVersion**: ${deviceInfo.oSVersion}\n"; + mutedMessage += '**DeviceName**: ${deviceInfo.machineName}\n'; + mutedMessage += '**OSVersion**: ${deviceInfo.oSVersion}\n'; - for (var mutedMsg in (mutedText ?? [])) { - mutedMessage += "$mutedMsg\n"; + for (var mutedMsg in mutedText ?? []) { + mutedMessage += '$mutedMsg\n'; } final submitMessage = "[MUTED]\n$mutedMessage[/MUTED]\n\n${message ?? ''}"; @@ -389,7 +395,7 @@ class CustomerSupportServiceImpl extends CustomerSupportService { 'title': issueTitle, 'message': submitMessage, 'tags': tags, - 'announcement_context_id': announcementID ?? "", + 'announcement_context_id': announcementID ?? '', }; return await _customerSupportApi.createIssue(payload); @@ -426,14 +432,12 @@ class CustomerSupportServiceImpl extends CustomerSupportService { } @override - Future reopen(String issueID) async { - return _customerSupportApi.reOpenIssue(issueID); - } + Future reopen(String issueID) async => + _customerSupportApi.reOpenIssue(issueID); @override - Future rateIssue(String issueID, int rating) async { - return _customerSupportApi.rateIssue(issueID, rating); - } + Future rateIssue(String issueID, int rating) async => + _customerSupportApi.rateIssue(issueID, rating); @override Future> getIssuesAndAnnouncement() async { @@ -450,8 +454,9 @@ class CustomerSupportServiceImpl extends CustomerSupportService { return false; })); } - result.addAll(issues); - result.addAll(announcements); + result + ..addAll(issues) + ..addAll(announcements); numberOfIssuesInfo.value = [ result.length, result @@ -494,14 +499,14 @@ class CustomerSupportServiceImpl extends CustomerSupportService { if (await _announcementDao .getAnnouncement(announcement.announcementContextId) == null) { - metricClient.addEvent( + unawaited(metricClient.addEvent( MixpanelEvent.receiveAnnouncement, data: { - "id": announcement.announcementContextId, - "type": announcement.type, - "title": announcement.title, + 'id': announcement.announcementContextId, + 'type': announcement.type, + 'title': announcement.title, }, - ); + )); } await _announcementDao .insertAnnouncement(AnnouncementLocal.fromAnnouncement(announcement)); @@ -515,22 +520,22 @@ class CustomerSupportServiceImpl extends CustomerSupportService { @override Future createAnnouncement(AnnouncementID type) async { - final body = {"announcement_context_id": type.value}; + final body = {'announcement_context_id': type.value}; await _announcementApi.callAnnouncement(body); await fetchAnnouncement(); final announcement = await _announcementDao.getAnnouncement(type.value); if (announcement != null) { await getIssuesAndAnnouncement(); showInfoNotification( - const Key("Announcement"), "au_has_announcement".tr(), + const Key('Announcement'), 'au_has_announcement'.tr(), addOnTextSpan: [ TextSpan( - text: "tap_to_view".tr(), + text: 'tap_to_view'.tr(), style: Theme.of(injector() .navigatorKey .currentContext!) .textTheme - .ppMori400Green14), + .ppMori400FFYellow14), ], openHandler: () { injector().navigateTo( AppRouter.supportThreadPage, @@ -557,7 +562,6 @@ class CustomerSupportServiceImpl extends CustomerSupportService { } @override - Future findAnnouncement(String announcementID) async { - return await _announcementDao.getAnnouncement(announcementID); - } + Future findAnnouncement(String announcementID) async => + await _announcementDao.getAnnouncement(announcementID); } diff --git a/lib/util/inapp_notifications.dart b/lib/util/inapp_notifications.dart index c3e915ad2..7ad3fd4a0 100644 --- a/lib/util/inapp_notifications.dart +++ b/lib/util/inapp_notifications.dart @@ -17,38 +17,36 @@ import 'package:overlay_support/overlay_support.dart'; import 'package:overlay_support/src/overlay_state_finder.dart'; Widget _notificationToast(BuildContext context, OSNotification notification, - {Function(OSNotification notification)? notificationOpenedHandler}) { - return _SimpleNotificationToast( - notification: notification.body ?? "", - key: Key(notification.notificationId), - notificationOpenedHandler: () { - if (notificationOpenedHandler != null) { - notificationOpenedHandler(notification); - } - }, - addOnTextSpan: [ - TextSpan( - text: ' ${'tap_to_view'.tr()}', - style: Theme.of(context).textTheme.ppMori400Green14, - ) - ], - ); -} + {Function(OSNotification notification)? notificationOpenedHandler}) => + _SimpleNotificationToast( + notification: notification.body ?? '', + key: Key(notification.notificationId), + notificationOpenedHandler: () { + if (notificationOpenedHandler != null) { + notificationOpenedHandler(notification); + } + }, + addOnTextSpan: [ + TextSpan( + text: ' ${'tap_to_view'.tr()}', + style: Theme.of(context).textTheme.ppMori400FFYellow14, + ) + ], + ); Widget _inAppNotificationToast(BuildContext context, String body, String key, - {Function()? notificationOpenedHandler}) { - return _SimpleNotificationToast( - notification: body, - key: Key(key), - notificationOpenedHandler: notificationOpenedHandler, - addOnTextSpan: [ - TextSpan( - text: ' ${'tap_to_view'.tr()}', - style: Theme.of(context).textTheme.ppMori400Green14, - ) - ], - ); -} + {Function()? notificationOpenedHandler}) => + _SimpleNotificationToast( + notification: body, + key: Key(key), + notificationOpenedHandler: notificationOpenedHandler, + addOnTextSpan: [ + TextSpan( + text: ' ${'tap_to_view'.tr()}', + style: Theme.of(context).textTheme.ppMori400FFYellow14, + ) + ], + ); class _SimpleNotificationToast extends StatelessWidget { const _SimpleNotificationToast({ @@ -196,7 +194,7 @@ void showNotifications(BuildContext context, OSNotification notification, void showInAppNotifications(BuildContext context, String body, String key, {Function()? notificationOpenedHandler}) { showSimpleNotification( - _inAppNotificationToast(context, body, "", + _inAppNotificationToast(context, body, '', notificationOpenedHandler: notificationOpenedHandler), background: Colors.transparent, duration: const Duration(seconds: 3), @@ -277,7 +275,7 @@ void showCustomNotifications(BuildContext context, String notification, Key key, void hideOverlay(Key key) { final OverlaySupportState? overlaySupport = findOverlayState(); if (overlaySupport == null) { - log.warning("Cannot find overlay key: $key"); + log.warning('Cannot find overlay key: $key'); return; } diff --git a/lib/util/style.dart b/lib/util/style.dart index 946db9fe5..38bbc0a6b 100644 --- a/lib/util/style.dart +++ b/lib/util/style.dart @@ -179,9 +179,9 @@ MarkdownStyleSheet markDownAnnouncementStyle(BuildContext context) { final theme = Theme.of(context); final bodyText2 = theme.textTheme.ppMori400White12; return MarkdownStyleSheet( - a: TextStyle( + a: const TextStyle( fontFamily: AppTheme.ppMori, - color: theme.auSuperTeal, + color: AppColor.feralFileHighlight, fontWeight: FontWeight.w400, fontSize: 14, ), @@ -364,7 +364,7 @@ MarkdownStyleSheet markDownChangeLogStyle(BuildContext context) { blockquotePadding: const EdgeInsets.only(left: 20), blockquoteDecoration: const BoxDecoration( border: Border( - left: BorderSide(width: 2, color: AppColor.auSuperTeal), + left: BorderSide(width: 2, color: AppColor.feralFileHighlight), ), ), codeblockPadding: const EdgeInsets.all(8), @@ -373,7 +373,7 @@ MarkdownStyleSheet markDownChangeLogStyle(BuildContext context) { borderRadius: BorderRadius.circular(2), ), horizontalRuleDecoration: CustomBoxDecoration( - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, ), ); } @@ -485,7 +485,7 @@ Divider addDivider({double height = 32, Color? color}) => Divider( Divider headDivider() => const Divider( height: 30, thickness: 3, - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, ); Divider addOnlyDivider({Color? color, double border = 1.0}) => Divider( @@ -606,7 +606,7 @@ class MomaPallet { Map? auHtmlStyle(dom.Element element) { if (element.localName == 'a') { - const linkColor = AppColor.auSuperTeal; + const linkColor = AppColor.feralFileHighlight; // convert linkColor to hex string String hexColor = "#${(linkColor.value & 0xFFFFFF).toRadixString(16).padLeft(6, '0')}"; diff --git a/lib/util/ui_helper.dart b/lib/util/ui_helper.dart index cfaae55f2..0e883045f 100644 --- a/lib/util/ui_helper.dart +++ b/lib/util/ui_helper.dart @@ -1122,7 +1122,7 @@ class UIHelper { const EdgeInsets.symmetric(horizontal: 15, vertical: 128), child: DecoratedBox( decoration: BoxDecoration( - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, borderRadius: BorderRadius.circular(5), ), child: Padding( @@ -1159,7 +1159,7 @@ class UIHelper { onPressed: actionButtonOnTap, borderColor: AppColor.primaryBlack, textColor: AppColor.primaryBlack, - backgroundColor: AppColor.auSuperTeal, + backgroundColor: AppColor.feralFileHighlight, ), const SizedBox( height: 15, @@ -1174,7 +1174,7 @@ class UIHelper { }, borderColor: AppColor.primaryBlack, textColor: AppColor.primaryBlack, - backgroundColor: AppColor.auSuperTeal, + backgroundColor: AppColor.feralFileHighlight, ), ], ), @@ -1315,7 +1315,7 @@ class UIHelper { barrierColor: Colors.black.withOpacity(0.5), isScrollControlled: true, builder: (context) => Container( - color: theme.auSuperTeal, + color: AppColor.feralFileHighlight, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/view/artwork_common_widget.dart b/lib/view/artwork_common_widget.dart index 9dea59ec4..0ba4de139 100644 --- a/lib/view/artwork_common_widget.dart +++ b/lib/view/artwork_common_widget.dart @@ -498,7 +498,7 @@ class PreviewUnSupportedTokenWidget extends StatelessWidget { child: Text( 'hide_from_collection'.tr(), style: theme.textTheme.ppMori400Black12 - .copyWith(color: AppColor.auSuperTeal), + .copyWith(color: AppColor.feralFileHighlight), ), ) ], @@ -569,7 +569,7 @@ class _BrokenTokenWidgetState extends State child: Text( 'reload'.tr(), style: theme.textTheme.ppMori400Black12 - .copyWith(color: AppColor.auSuperTeal), + .copyWith(color: AppColor.feralFileHighlight), ), ) ], @@ -1502,7 +1502,7 @@ class MetaDataItem extends StatelessWidget { overflow: TextOverflow.ellipsis, maxLines: 3, style: onValueTap != null - ? linkStyle ?? theme.textTheme.ppMori400Green14 + ? linkStyle ?? theme.textTheme.ppMori400FFYellow14 : valueStyle ?? theme.textTheme.ppMori400White14, ), ), @@ -1577,14 +1577,14 @@ class ProvenanceItem extends StatelessWidget { const EdgeInsets.symmetric(horizontal: 10, vertical: 4), decoration: BoxDecoration( border: Border.all( - color: theme.auSuperTeal, + color: AppColor.feralFileHighlight, ), borderRadius: BorderRadius.circular(64), ), child: Text( 'view'.tr(), overflow: TextOverflow.ellipsis, - style: theme.textTheme.ppMori400Green14, + style: theme.textTheme.ppMori400FFYellow14, ), ), ), @@ -1660,8 +1660,8 @@ Widget artworkDetailsProvenanceSectionNotEmpty( // subTitle: el.blockchain.toUpperCase(), tapLink: el.txURL, onNameTap: () => identity != null - ? UIHelper.showIdentityDetailDialog(context, - name: identity, address: el.owner) + ? unawaited(UIHelper.showIdentityDetailDialog(context, + name: identity, address: el.owner)) : null, forceSafariVC: true, ), @@ -1964,7 +1964,7 @@ class ArtworkDetailsHeader extends StatelessWidget { child: Text( subTitle, style: theme.textTheme.ppMori700White14.copyWith( - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, fontWeight: isReverse ? FontWeight.w400 : null), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -1977,7 +1977,7 @@ class ArtworkDetailsHeader extends StatelessWidget { child: Text( title, style: theme.textTheme.ppMori400White14.copyWith( - color: AppColor.auSuperTeal, + color: AppColor.feralFileHighlight, fontWeight: isReverse ? FontWeight.w700 : null), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/view/canvas_device_view.dart b/lib/view/canvas_device_view.dart index e9015332c..675308457 100644 --- a/lib/view/canvas_device_view.dart +++ b/lib/view/canvas_device_view.dart @@ -85,7 +85,7 @@ class _CanvasDeviceViewState extends State { ), TextSpan( text: 'compatible_platforms'.tr(), - style: theme.textTheme.ppMori400Green14, + style: theme.textTheme.ppMori400FFYellow14, recognizer: TapGestureRecognizer() ..onTap = () async => Navigator.of(context) .pushNamed(AppRouter.canvasHelpPage), @@ -159,13 +159,13 @@ class _CanvasDeviceViewState extends State { children: [ Text( 'add_new_frame'.tr(), - style: theme.textTheme.ppMori400Green14, + style: theme.textTheme.ppMori400FFYellow14, ), const Spacer(), SvgPicture.asset( 'assets/images/joinFile.svg', colorFilter: const ColorFilter.mode( - AppColor.auSuperTeal, BlendMode.srcIn), + AppColor.feralFileHighlight, BlendMode.srcIn), ), ], ), @@ -252,15 +252,15 @@ class _CanvasDeviceViewState extends State { Container( decoration: BoxDecoration( color: Colors.transparent, - border: Border.all(color: AppColor.auSuperTeal), + border: Border.all(color: AppColor.feralFileHighlight), borderRadius: BorderRadius.circular(15), ), padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 5, ), - child: - Text('playing'.tr(), style: theme.textTheme.ppMori400Green12), + child: Text('playing'.tr(), + style: theme.textTheme.ppMori400FFYellow14), ), const SizedBox(width: 20), GestureDetector( @@ -303,8 +303,8 @@ class _CanvasDeviceViewState extends State { }, child: SvgPicture.asset( 'assets/images/help_icon.svg', - colorFilter: - const ColorFilter.mode(AppColor.auSuperTeal, BlendMode.srcIn), + colorFilter: const ColorFilter.mode( + AppColor.feralFileHighlight, BlendMode.srcIn), ), ); } diff --git a/lib/view/important_note_view.dart b/lib/view/important_note_view.dart index dababa5e9..adcca4601 100644 --- a/lib/view/important_note_view.dart +++ b/lib/view/important_note_view.dart @@ -12,25 +12,25 @@ import 'package:flutter/material.dart'; class ImportantNoteView extends StatelessWidget { final String note; - const ImportantNoteView({super.key, required this.note}); + const ImportantNoteView({required this.note, super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Container( - decoration: BoxDecoration( - color: theme.auSuperTeal, - borderRadius: const BorderRadius.all(Radius.circular(5.0)), + decoration: const BoxDecoration( + color: AppColor.feralFileHighlight, + borderRadius: BorderRadius.all(Radius.circular(5)), ), - padding: const EdgeInsets.all(15.0), + padding: const EdgeInsets.all(15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "important".tr(), + 'important'.tr(), style: theme.textTheme.ppMori700Black14, ), - const SizedBox(height: 15.0), + const SizedBox(height: 15), Text( note, style: theme.textTheme.ppMori400Black14, diff --git a/lib/view/modal_widget.dart b/lib/view/modal_widget.dart index c4f3258bb..194d5880e 100644 --- a/lib/view/modal_widget.dart +++ b/lib/view/modal_widget.dart @@ -12,33 +12,30 @@ import 'package:flutter/material.dart'; class ModalSheet extends StatelessWidget { final Widget child; - const ModalSheet({super.key, required this.child}); + const ModalSheet({required this.child, super.key}); @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - return Container( - color: theme.auSuperTeal, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: () => Navigator.pop(context), - icon: const Icon( - AuIcon.close, - size: 18, + Widget build(BuildContext context) => Container( + color: AppColor.feralFileHighlight, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Align( + alignment: Alignment.centerRight, + child: IconButton( + onPressed: () => Navigator.pop(context), + icon: const Icon( + AuIcon.close, + size: 18, + ), ), ), - ), - const SizedBox(height: 32), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: child, - ), - ], - ), - ); - } + const SizedBox(height: 32), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: child, + ), + ], + ), + ); } diff --git a/lib/view/number_picker.dart b/lib/view/number_picker.dart deleted file mode 100644 index 3b5dd0cfd..000000000 --- a/lib/view/number_picker.dart +++ /dev/null @@ -1,109 +0,0 @@ -import 'package:autonomy_theme/autonomy_theme.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; - -class NumberPicker extends StatefulWidget { - final double value; - final Function(double) onChange; - final double min; - final double max; - final int divisions; - final TextStyle? selectedStyle; - final TextStyle? unselectedStyle; - - const NumberPicker({ - Key? key, - required this.value, - required this.onChange, - required this.min, - required this.max, - required this.divisions, - this.selectedStyle, - this.unselectedStyle, - }) : super(key: key); - - @override - State createState() => _NumberPickerState(); -} - -class _NumberPickerState extends State { - late double _selectedValue; - @override - void initState() { - _selectedValue = widget.value; - super.initState(); - } - - @override - Widget build(BuildContext context) { - return _numberSlide( - context: context, - value: _selectedValue, - onChange: widget.onChange, - min: widget.min, - max: widget.max, - divisions: widget.divisions, - selectedStyle: widget.selectedStyle, - unselectedStyle: widget.unselectedStyle, - ); - } - - Widget _numberSlide({ - required BuildContext context, - required double value, - required Function(double) onChange, - required double min, - required double max, - required int divisions, - TextStyle? selectedStyle, - TextStyle? unselectedStyle, - }) { - final theme = Theme.of(context); - final numberFormater = NumberFormat('00'); - return Column( - children: [ - SliderTheme( - data: const SliderThemeData( - trackHeight: 4.0, - thumbShape: RoundSliderThumbShape(enabledThumbRadius: 12.0), - overlayShape: RoundSliderOverlayShape(overlayRadius: 20.0), - rangeThumbShape: RoundRangeSliderThumbShape( - enabledThumbRadius: 12.0, - ), - ), - child: Slider( - value: value, - onChanged: (value) { - onChange(value); - setState(() { - _selectedValue = value; - }); - }, - divisions: divisions, - min: 12, - max: 18, - activeColor: Colors.black.withOpacity(0.2), - inactiveColor: Colors.black.withOpacity(0.2), - thumbColor: Colors.black, - overlayColor: MaterialStateColor.resolveWith( - (states) => Colors.transparent, - )), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - //list from a to b - children: - List.generate(divisions + 1, (index) => index + min).map((e) { - return Text( - '${numberFormater.format(e)} pt', - style: (e == value) - ? (selectedStyle ?? theme.textTheme.ppMori400SupperTeal12) - : (unselectedStyle ?? theme.textTheme.ppMori400White12), - ); - }).toList(), - ), - const SizedBox(height: 50), - ], - ); - } -} diff --git a/lib/view/tip_card.dart b/lib/view/tip_card.dart index e90f79fa1..a1f422e9f 100644 --- a/lib/view/tip_card.dart +++ b/lib/view/tip_card.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:autonomy_flutter/common/injector.dart'; import 'package:autonomy_flutter/service/metric_client_service.dart'; import 'package:autonomy_flutter/util/constants.dart'; @@ -15,12 +17,12 @@ class Tipcard extends StatelessWidget { final ValueNotifier listener; const Tipcard({ - super.key, required this.titleText, - this.onPressed, - this.buttonText, required this.content, required this.listener, + super.key, + this.onPressed, + this.buttonText, this.onClosed, }); @@ -31,66 +33,64 @@ class Tipcard extends StatelessWidget { return ValueListenableBuilder( valueListenable: listener, - builder: (context, value, Widget? child) { - return value - ? Container( - padding: - const EdgeInsets.symmetric(horizontal: 15, vertical: 15), - decoration: BoxDecoration( - color: AppColor.auSuperTeal, - borderRadius: BorderRadius.circular(10), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(titleText, - style: theme.textTheme.ppMori700Black14), - const Spacer(), - IconButton( - padding: EdgeInsets.zero, - constraints: - const BoxConstraints(minWidth: 16, minHeight: 16), - icon: const Icon( - Icons.close, - ), - color: AppColor.primaryBlack, - onPressed: () { - if (onClosed != null) onClosed!(); - metricClient - .addEvent(MixpanelEvent.closeTipcard, data: { - 'title': titleText, - }); - listener.value = false; - }, + builder: (context, value, Widget? child) => value + ? Container( + padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15), + decoration: BoxDecoration( + color: AppColor.feralFileHighlight, + borderRadius: BorderRadius.circular(10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(titleText, style: theme.textTheme.ppMori700Black14), + const Spacer(), + IconButton( + padding: EdgeInsets.zero, + constraints: + const BoxConstraints(minWidth: 16, minHeight: 16), + icon: const Icon( + Icons.close, ), - ], - ), + color: AppColor.primaryBlack, + onPressed: () { + if (onClosed != null) { + onClosed!(); + } + unawaited(metricClient + .addEvent(MixpanelEvent.closeTipcard, data: { + 'title': titleText, + })); + listener.value = false; + }, + ), + ], + ), + const SizedBox(height: 15), + content, + if (buttonText != null || onPressed != null) ...[ const SizedBox(height: 15), - content, - if (buttonText != null || onPressed != null) ...[ - const SizedBox(height: 15), - OutlineButton( - color: AppColor.auSuperTeal, - textColor: AppColor.primaryBlack, - borderColor: AppColor.primaryBlack, - text: buttonText ?? "close".tr(), - onTap: () { - () {}; - metricClient - .addEvent(MixpanelEvent.pressTipcard, data: { - 'title': titleText, - }); - listener.value = false; - }), - ] - ], - ), - ) - : const SizedBox(); - }, + OutlineButton( + color: AppColor.feralFileHighlight, + textColor: AppColor.primaryBlack, + borderColor: AppColor.primaryBlack, + text: buttonText ?? 'close'.tr(), + onTap: () { + () {}; + unawaited(metricClient + .addEvent(MixpanelEvent.pressTipcard, data: { + 'title': titleText, + })); + listener.value = false; + }), + ] + ], + ), + ) + : const SizedBox(), ); } } diff --git a/pubspec.lock b/pubspec.lock index 60d6ab6fc..ff3b1dbd6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -93,8 +93,8 @@ packages: dependency: "direct main" description: path: "." - ref: "3bef7f852a5e7d87b5a9638368c697242eb6a212" - resolved-ref: "3bef7f852a5e7d87b5a9638368c697242eb6a212" + ref: c667b128bf647ed2ece6f275b21a77839da434f2 + resolved-ref: c667b128bf647ed2ece6f275b21a77839da434f2 url: "https://github.com/bitmark-inc/autonomy-client-shared-theme.git" source: git version: "0.0.1+20" diff --git a/pubspec.yaml b/pubspec.yaml index 13b573be3..94a3c957c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -114,7 +114,7 @@ dependencies: autonomy_theme: git: url: https://github.com/bitmark-inc/autonomy-client-shared-theme.git - ref: 3bef7f852a5e7d87b5a9638368c697242eb6a212 + ref: c667b128bf647ed2ece6f275b21a77839da434f2 marqueer: ^1.2.0 markdown: ^7.1.1 easy_localization: ^3.0.1 From b7b781bb8d636f19447c6158ebe4e03dcfdb882f Mon Sep 17 00:00:00 2001 From: phuoc Date: Mon, 8 Jan 2024 14:32:26 +0700 Subject: [PATCH 2/2] init new collection: focus on name field Signed-off-by: phuoc --- .../playlists/add_new_playlist/add_new_playlist.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/screen/playlists/add_new_playlist/add_new_playlist.dart b/lib/screen/playlists/add_new_playlist/add_new_playlist.dart index 5404e1c50..c61966b20 100644 --- a/lib/screen/playlists/add_new_playlist/add_new_playlist.dart +++ b/lib/screen/playlists/add_new_playlist/add_new_playlist.dart @@ -67,6 +67,9 @@ class _AddNewPlaylistScreenState extends State nftBloc.add(GetTokensByOwnerEvent(pageKey: PageKey.init())); })); bloc.add(InitPlaylist(playListModel: widget.playListModel)); + WidgetsBinding.instance.addPostFrameCallback((context) { + _focusCollectionName(); + }); } @override @@ -76,6 +79,10 @@ class _AddNewPlaylistScreenState extends State injector().showCreatePlaylistTip.value = false; } + void _focusCollectionName() { + FocusScope.of(context).requestFocus(_focusNode); + } + void _scrollListenerToLoadMore() { if (_controller.position.pixels + 100 >= _controller.position.maxScrollExtent) {