| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- import 'package:fast/constants.dart';
- import 'package:fast/model/model.dart';
- import 'package:fast/utils/api.dart';
- import 'package:fast/utils/http_utils.dart';
- import 'package:fast/utils/size_fit.dart';
- import 'package:fast/view/component/challenge_result.dart';
- import 'package:fast/view/component/share.dart';
- import 'package:flutter/material.dart';
- class NotifiEnter extends StatefulWidget {
- String fastId;
- NotifiEnter({Key? key, required this.fastId}) : super(key: key);
- @override
- State<NotifiEnter> createState() => _NotifiEnterState();
- }
- class _NotifiEnterState extends State<NotifiEnter> {
- FastResultBean? resultBean;
- @override
- void initState() {
- super.initState();
- getDetail();
- }
- share() {
- showDialog(
- context: context,
- barrierDismissible: false,
- barrierColor: const Color(0xF2000D1F),
- builder: (BuildContext context) {
- return Share(
- type: 'challenge',
- resultBean: resultBean,
- );
- });
- }
- Future getDetail() async {
- Map<String, dynamic> data =
- await HttpUtils.get(Api.profits + widget.fastId, params: {});
- setState(() {
- resultBean = FastResultBean.fromJson(data);
- });
- }
- @override
- Widget build(BuildContext context) {
- // ignore: unnecessary_null_comparison
- if (resultBean == null) {
- return Container(
- color: kBgColor,
- );
- }
- String resultTip = 'assets/images/challenge_failed.png';
- if (resultBean!.checkinStatus == 'SUCCESS') {
- resultTip = 'assets/images/challenge_success.png';
- } else if (resultBean!.checkinStatus == 'TIMEOUT') {
- resultTip = 'assets/images/challenge_done.png';
- }
- var size = MediaQuery.of(context).size;
- return Container(
- decoration: BoxDecoration(
- image: DecorationImage(
- image: AssetImage(
- 'assets/images/${resultBean!.days}day_result_bg.png'),
- fit: BoxFit.cover),
- ),
- alignment: Alignment.center,
- child: Column(
- children: [
- SizedBox(
- height: 54.px,
- ),
- Row(
- children: [
- GestureDetector(
- onTap: () {
- Navigator.of(context).pop();
- },
- child: Container(
- margin: EdgeInsets.only(left: 8.px,bottom: 11.px),
- alignment: Alignment.center,
- width: 44.px,
- height: 32.px,
- decoration: BoxDecoration(
- color: const Color(0x33000000),
- borderRadius: BorderRadius.all(Radius.circular(16.px)),
- border: Border.all(width: 1.px,color: const Color(0x33ffffff))
- ),
- child: Image.asset('assets/images/home.png',width: 20.px,height: 20.px,),
- ),
- )
- ],
- ),
- Opacity(
- opacity: 1.0,
- child: Image.asset(
- resultTip,
- width: 204.px,
- height: 72.px,
- ),
- ),
- SizedBox(
- height: 16.px,
- ),
- Opacity(
- opacity: 1.0,
- child: Container(
- width: 324.px,
- height: 260.px,
- decoration: BoxDecoration(
- color: const Color(0xCC000D1F),
- borderRadius: BorderRadius.all(Radius.circular(32.px)),
- border: Border.all(color: kThemeColor, width: 1.px),
- image: const DecorationImage(
- image: AssetImage('assets/images/statistic.png'),
- alignment: Alignment.topRight,
- scale: 2.9)),
- child: Statistic(
- resultBean: resultBean!,
- rate: 1.0,
- )),
- ),
- // SizedBox(
- // height: (1 - bottomAni.value) * 40.px + 20.px,
- // ),
- const Expanded(
- child: SizedBox(
- width: 0,
- height: 0,
- )),
- Opacity(
- opacity: 1,
- child: Column(
- children: [
- Text(
- '邀请好友注册成功',
- style: TextStyle(
- decoration: TextDecoration.none,
- fontWeight: FontWeight.normal,
- fontSize: 12.px,
- color: const Color(0x99FFFFFF)),
- ),
- SizedBox(
- height: 7.px,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '我和ta各得逆龄石',
- style: TextStyle(
- decoration: TextDecoration.none,
- fontWeight: FontWeight.normal,
- fontSize: 12.px,
- height: 1.0,
- color: const Color(0x99FFFFFF)),
- ),
- SizedBox(
- width: 2.px,
- ),
- Text(
- '+3',
- style: TextStyle(
- decoration: TextDecoration.none,
- fontWeight: FontWeight.w600,
- fontSize: 14.px,
- height: 1.0,
- fontFamily: 'Exo2',
- color: const Color(0x99FFFFFF)),
- ),
- SizedBox(
- width: 2.px,
- ),
- Image.asset(
- 'assets/images/stone.png',
- width: 14.px,
- height: 14.px,
- )
- ],
- ),
- GestureDetector(
- onTap: () {
- share();
- },
- child: Container(
- width: 228.px,
- height: 48.px,
- margin: EdgeInsets.only(top: 25.px, bottom: 12.px),
- decoration: BoxDecoration(
- borderRadius:
- BorderRadius.all(Radius.circular(24.px)),
- border: Border.all(color: kThemeColor, width: 1.px),
- image: const DecorationImage(
- image: AssetImage('assets/images/invite.png'),
- alignment: Alignment.center,
- scale: 1.8)),
- ),
- ),
- SizedBox(
- // height: 50.px,
- height: size.height < 812.px ? 54.px : 108.px,
- )
- ],
- ),
- )
- ],
- ));
- }
- }
|