CakeWallet/lib/src/screens/dashboard/widgets/sync_indicator.dart

126 lines
4.1 KiB
Dart
Raw Normal View History

Cw 396 additional themes (#962) * fix: SectionStandardList using BuildContext as param * refactor: deprecated backgroundColor -> colorScheme.background * refactor: themeBase and current themes * refactor: accentTextTheme.titleLarge.color -> dialogTheme.backgroundColor * refactor: gradient background * refactor: text themes using the same color as primaryColor * refactor: accentTextTheme.bodySmall.color -> cardColor * refactor: text themes using same dialogBackgroundColor * refactor: scrollbarTheme * refactor: create SyncIndicatorTheme * refactor: SectionDivider * refactor: base_page improvements and simplify * refactor: collapsible_standart_list improvements * refactor: accentTextTheme.bodyLarge.backgroundColor -> KeyboardTheme.keyboardBarColor * refactor: create PinCodeTheme for accentTextTheme.bodyMedium * refactor: create SupportPageTheme for accentTextTheme.displayLarge.backgroundColor and fix cases that use it * refactor: accentTextTheme.displayLarge.color -> disabledColor * refactor: create ExchangePageTheme * refactor: create DashboardPageTheme and use textColor * refactor: create NewWalletTheme for accentTextTheme.displayMedium * refactor: create BalancePageTheme for accentTextTheme.displaySmall.backgroundColor * refactor: create AddressTheme for accentTextTheme.displaySmall.color * refactor: create IndicatorDotTheme * refactor: create CakeMenuTheme * refactor: create FilterTheme * refactor: create WalletListTheme * refactor: accentTextTheme.bodySmall.decorationColor -> InfoTheme.textColor * refactor: accentTextTheme.titleLarge.backgroundColor -> PickerTheme.dividerColor * refactor: primaryTextTheme.bodyLarge.backgroundColor -> AlertTheme.leftButtonTextColor * refactor: primaryTextTheme.displayLarge.backgroundColor -> OrderTheme.iconColor * refactor: create SendPageTheme * fix: missing migrated styles * refactor: primaryTextTheme.labelSmall.decorationColor -> PlaceholderTheme.color * refactor: create TransactionTradeTheme * refactor: create CakeTextTheme * refactor: create AccountListTheme * refactor: create ReceivePageTheme * refactor: create QRCodeTheme * refactor: move remaining items to CakeTextTheme and some missing fixes * feat(display_settings): add new theme selector * feat: additional themes * fix: conflict error * fix(lag): move colorScheme initialization to constructor * feat: add backdropColor to alert and picker backdrop filters * fix: merge fixes * fix: send template page missing new colors * fix: anonpay pages title and icon colors * fix: merge fixes * fix: unspent coins page * fix: also fix exchange template * fix: missing checkbox * fix: fixes for high contrast theme * Merge branch 'main' into CW-396-additional-themes * fix: merge fixes * fix: .gitignore and rm added files * Fix review comments --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2023-08-17 12:28:31 -03:00
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
2021-12-24 14:37:24 +02:00
import 'package:cake_wallet/core/sync_status_title.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
2021-12-24 14:37:24 +02:00
import 'package:cw_core/sync_status.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
class SyncIndicator extends StatelessWidget {
CW-727/728-Automated-Integrated-Tests (#1514) * feat: Integration tests setup and tests for Disclaimer, Welcome and Setup Pin Code pages * feat: Integration test flow from start to restoring a wallet successfully done * test: Dashboard view test and linking to flow * feat: Testing the Exchange flow section, selecting sending and receiving currencies * test: Successfully create an exchange section * feat: Implement flow up to sending section * test: Complete Exchange flow * fix dependency issue * test: Final cleanups * feat: Add CI to run automated integration tests withan android emulator * feat: Adjust Automated integration test CI to run on ubuntu 20.04-a * fix: Move integration test CI into PR test build CI * ci: Add automated test ci which is a streamlined replica of pr test build ci * ci: Re-add step to access branch name * ci: Add KVM * ci: Add filepath to trigger the test run from * ci: Add required key * ci: Add required key * ci: Add missing secret key * ci: Add missing secret key * ci: Add nano secrets to workflow * ci: Switch step to free space on runner * ci: Remove timeout from workflow * ci: Confirm impact that removing copy_monero_deps would have on entire workflow time * ci: Update CI and temporarily remove cache related to emulator * ci: Remove dynamic java version * ci: Temporarily switch CI * ci: Switch to 11.x jdk * ci: Temporarily switch CI * ci: Revert ubuntu version * ci: Add more api levels * ci: Add more target options * ci: Settled on stable emulator matrix options * ci: Add more target options * ci: Modify flow * ci: Streamline api levels to 28 and 29 * ci: One more trial * ci: Switch to flutter drive * ci: Reduce options * ci: Remove haven from test * ci: Check for solana in list * ci: Adjust amounts and currencies for exchange flow * ci: Set write response on failure to true * ci: Split ci to funds and non funds related tests * test: Test for Send flow scenario and minor restructuring for test folders and files * chore: cleanup * ci: Pause CI for now * ci: Pause CI for now * ci: Pause CI for now * Fix: Add keys back to currency amount textfield widget * fix: Switch variable name * fix: remove automation for now * test: Updating send page robot and also syncing branch with main --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-09-22 03:46:51 +01:00
SyncIndicator({
required this.dashboardViewModel,
required this.onTap,
super.key,
});
final DashboardViewModel dashboardViewModel;
final Function() onTap;
@override
Widget build(BuildContext context) {
2025-04-15 13:43:55 -03:00
return Observer(builder: (_) {
final syncIndicatorWidth = 237.0;
final status = dashboardViewModel.status;
final statusText = syncStatusTitle(status);
final isScanning = status is SyncingSyncStatus;
2025-04-15 13:43:55 -03:00
final progress = status.progress();
final indicatorOffset = progress * syncIndicatorWidth;
final indicatorWidth = progress < 1
? indicatorOffset > 0
? indicatorOffset
: 0.0
: syncIndicatorWidth;
2025-04-15 13:43:55 -03:00
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15)),
child: GestureDetector(
onTap: onTap,
child: Container(
height: 30,
width: syncIndicatorWidth,
Cw 396 additional themes (#962) * fix: SectionStandardList using BuildContext as param * refactor: deprecated backgroundColor -> colorScheme.background * refactor: themeBase and current themes * refactor: accentTextTheme.titleLarge.color -> dialogTheme.backgroundColor * refactor: gradient background * refactor: text themes using the same color as primaryColor * refactor: accentTextTheme.bodySmall.color -> cardColor * refactor: text themes using same dialogBackgroundColor * refactor: scrollbarTheme * refactor: create SyncIndicatorTheme * refactor: SectionDivider * refactor: base_page improvements and simplify * refactor: collapsible_standart_list improvements * refactor: accentTextTheme.bodyLarge.backgroundColor -> KeyboardTheme.keyboardBarColor * refactor: create PinCodeTheme for accentTextTheme.bodyMedium * refactor: create SupportPageTheme for accentTextTheme.displayLarge.backgroundColor and fix cases that use it * refactor: accentTextTheme.displayLarge.color -> disabledColor * refactor: create ExchangePageTheme * refactor: create DashboardPageTheme and use textColor * refactor: create NewWalletTheme for accentTextTheme.displayMedium * refactor: create BalancePageTheme for accentTextTheme.displaySmall.backgroundColor * refactor: create AddressTheme for accentTextTheme.displaySmall.color * refactor: create IndicatorDotTheme * refactor: create CakeMenuTheme * refactor: create FilterTheme * refactor: create WalletListTheme * refactor: accentTextTheme.bodySmall.decorationColor -> InfoTheme.textColor * refactor: accentTextTheme.titleLarge.backgroundColor -> PickerTheme.dividerColor * refactor: primaryTextTheme.bodyLarge.backgroundColor -> AlertTheme.leftButtonTextColor * refactor: primaryTextTheme.displayLarge.backgroundColor -> OrderTheme.iconColor * refactor: create SendPageTheme * fix: missing migrated styles * refactor: primaryTextTheme.labelSmall.decorationColor -> PlaceholderTheme.color * refactor: create TransactionTradeTheme * refactor: create CakeTextTheme * refactor: create AccountListTheme * refactor: create ReceivePageTheme * refactor: create QRCodeTheme * refactor: move remaining items to CakeTextTheme and some missing fixes * feat(display_settings): add new theme selector * feat: additional themes * fix: conflict error * fix(lag): move colorScheme initialization to constructor * feat: add backdropColor to alert and picker backdrop filters * fix: merge fixes * fix: send template page missing new colors * fix: anonpay pages title and icon colors * fix: merge fixes * fix: unspent coins page * fix: also fix exchange template * fix: missing checkbox * fix: fixes for high contrast theme * Merge branch 'main' into CW-396-additional-themes * fix: merge fixes * fix: .gitignore and rm added files * Fix review comments --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2023-08-17 12:28:31 -03:00
color: Theme.of(context).extension<SyncIndicatorTheme>()!.notSyncedBackgroundColor,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
progress <= 1
2025-04-15 13:43:55 -03:00
? Positioned(
left: 0,
top: 0,
bottom: 0,
child: Container(
width: indicatorWidth,
height: 30,
color: Theme.of(context)
.extension<SyncIndicatorTheme>()!
.syncedBackgroundColor,
))
: Offstage(),
Padding(
2025-04-15 13:43:55 -03:00
padding: EdgeInsets.only(left: 24, right: 24),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
2025-04-15 13:43:55 -03:00
SyncIndicatorIcon(isSynced: status is SyncedSyncStatus),
Padding(
padding: EdgeInsets.only(left: 6),
child: isScanning
? Text(
statusText,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color:
Theme.of(context).extension<SyncIndicatorTheme>()!.textColor,
),
)
: RollingText(statusText),
)
],
),
)
],
),
),
2025-04-15 13:43:55 -03:00
),
);
});
}
}
class RollingText extends StatelessWidget {
const RollingText(this.text);
final String text;
@override
Widget build(BuildContext context) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) {
final inAnimation = Tween<Offset>(
begin: const Offset(0.0, -1.0),
end: Offset.zero,
).animate(animation);
return ClipRect(
child: SlideTransition(
position: inAnimation,
child: child,
),
);
},
child: Text(
text,
key: ValueKey(text),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Theme.of(context).extension<SyncIndicatorTheme>()!.textColor,
),
),
);
}
2025-04-15 13:43:55 -03:00
}