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

View file

@ -477,6 +477,14 @@ packages:
description: flutter
source: sdk
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:
dependency: transitive
description:

View file

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