improve pay coin

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-24 12:24:07 +08:00
parent 99a950b049
commit c2ceb9ec73
7 changed files with 95 additions and 121 deletions

View File

@@ -15,33 +15,35 @@ import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
typedef OnPayCoin = Function(int coin, bool coinWithLike);
class PayCoinsPage extends StatefulWidget {
const PayCoinsPage({
super.key,
required this.onPayCoin,
int copyright = 1,
this.hasCoin = false,
}) : hasCopyright = copyright != 2;
required this.hasCoin,
required this.hasCopyright,
});
final Function(int coin, bool coinWithLike) onPayCoin;
final bool hasCopyright;
final OnPayCoin onPayCoin;
final bool hasCoin;
final bool hasCopyright;
@override
State<PayCoinsPage> createState() => _PayCoinsPageState();
static void toPayCoinsPage({
required Function(int coin, bool coinWithLike) onPayCoin,
int copyright = 1,
bool hasCoin = false,
required OnPayCoin onPayCoin,
required bool hasCoin,
required bool hasCopyright,
}) {
Get.key.currentState!.push(
PublishRoute(
pageBuilder: (buildContext, animation, secondaryAnimation) {
return PayCoinsPage(
onPayCoin: onPayCoin,
copyright: copyright,
hasCoin: hasCoin,
hasCopyright: hasCopyright,
);
},
transitionDuration: const Duration(milliseconds: 225),
@@ -200,38 +202,38 @@ class _PayCoinsPageState extends State<PayCoinsPage>
Widget _buildCoinWidget(int index, double factor) {
final filter = _getPayFilter(index);
final boxSize = 70 + (factor * 30);
final coinSize = 35 + (factor * 15);
return Center(
child: SizedBox.square(
dimension: 70 + (factor * 30),
child: ColorFiltered(
colorFilter: ColorFilter.mode(
filter,
BlendMode.srcATop,
),
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [
SlideTransition(
position: _boxAnim,
child: Image.asset(Assets.payBox),
),
SlideTransition(
position: _coinSlideAnim,
child: FadeTransition(
opacity: _coinFadeAnim,
child: Image.asset(
height: coinSize,
width: coinSize,
index == 0 ? Assets.coinsOne : Assets.coinsTwo,
),
),
),
],
return Stack(
alignment: .center,
clipBehavior: .none,
children: [
SlideTransition(
position: _boxAnim,
child: Image.asset(
Assets.payBox,
color: filter,
width: boxSize,
height: boxSize,
cacheWidth: 100.cacheSize(context),
colorBlendMode: .srcATop,
),
),
),
SlideTransition(
position: _coinSlideAnim,
child: FadeTransition(
opacity: _coinFadeAnim,
child: Image.asset(
height: coinSize,
width: coinSize,
cacheWidth: 50.cacheSize(context),
color: filter,
colorBlendMode: .srcATop,
index == 0 ? Assets.coinsOne : Assets.coinsTwo,
),
),
),
],
);
}