Added shimmer animation to golden banner in settings

This commit is contained in:
ashilkn 2023-02-22 18:23:06 +05:30
parent c03a34fa21
commit 09fe8288d7
3 changed files with 29 additions and 13 deletions

View file

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import "package:flutter_animate/flutter_animate.dart";
import 'package:photos/core/configuration.dart'; import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart'; import 'package:photos/core/event_bus.dart';
import 'package:photos/events/opened_settings_event.dart'; import 'package:photos/events/opened_settings_event.dart';
@ -46,6 +47,8 @@ class SettingsPage extends StatelessWidget {
} }
Widget _getBody(BuildContext context, EnteColorScheme colorScheme) { Widget _getBody(BuildContext context, EnteColorScheme colorScheme) {
Animate.restartOnHotReload = true;
final hasLoggedIn = Configuration.instance.isLoggedIn(); final hasLoggedIn = Configuration.instance.isLoggedIn();
final enteTextTheme = getEnteTextTheme(context); final enteTextTheme = getEnteTextTheme(context);
final List<Widget> contents = []; final List<Widget> contents = [];
@ -77,19 +80,23 @@ class SettingsPage extends StatelessWidget {
contents.addAll([ contents.addAll([
const StorageCardWidget(), const StorageCardWidget(),
StorageBonusService.instance.shouldShowStorageBonus() StorageBonusService.instance.shouldShowStorageBonus()
? Padding( ? RepaintBoundary(
padding: const EdgeInsets.symmetric(vertical: 8.0), child: Padding(
child: NotificationWidget( padding: const EdgeInsets.symmetric(vertical: 8.0),
startIcon: Icons.auto_awesome, child: NotificationWidget(
actionIcon: Icons.arrow_forward_outlined, startIcon: Icons.auto_awesome,
text: "Double your storage", actionIcon: Icons.arrow_forward_outlined,
subText: "Refer friends and 2x your plan", text: "Double your storage",
type: NotificationType.goldenBanner, subText: "Refer friends and 2x your plan",
onTap: () async { type: NotificationType.goldenBanner,
StorageBonusService.instance.markStorageBonusAsDone(); onTap: () async {
routeToPage(context, const ReferralScreen()); StorageBonusService.instance.markStorageBonusAsDone();
}, routeToPage(context, const ReferralScreen());
), },
),
)
.animate(onPlay: (controller) => controller.repeat())
.shimmer(duration: 1000.ms, delay: 4000.ms, size: 0.6),
) )
: const SizedBox(height: 12), : const SizedBox(height: 12),
const BackupSectionWidget(), const BackupSectionWidget(),

View file

@ -477,6 +477,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_animate:
dependency: "direct main"
description:
name: flutter_animate
sha256: c6e38af9fe376fa07fb6995fe6a12d07a08828d2847aa652b7c1bc60f9993374
url: "https://pub.dev"
source: hosted
version: "4.1.0"
flutter_blurhash: flutter_blurhash:
dependency: transitive dependency: transitive
description: description:

View file

@ -49,6 +49,7 @@ dependencies:
fk_user_agent: ^2.0.1 fk_user_agent: ^2.0.1
flutter: flutter:
sdk: flutter sdk: flutter
flutter_animate: ^4.1.0
flutter_cache_manager: ^3.3.0 flutter_cache_manager: ^3.3.0
flutter_datetime_picker: ^1.5.1 flutter_datetime_picker: ^1.5.1
flutter_easyloading: ^3.0.0 flutter_easyloading: ^3.0.0