Updated NoWinnerFoundDesign and some Logical Up gradations
parent
02fdfc746c
commit
d9749fc402
File diff suppressed because one or more lines are too long
@ -0,0 +1,202 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_countdown_timer/current_remaining_time.dart';
|
||||||
|
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||||
|
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||||
|
import 'package:mohem_flutter_app/main.dart';
|
||||||
|
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
||||||
|
|
||||||
|
class CountdownTimerForDetailScreen extends StatelessWidget {
|
||||||
|
final int timeToMarathon;
|
||||||
|
final MarathonProvider provider;
|
||||||
|
|
||||||
|
CountdownTimerForDetailScreen({
|
||||||
|
Key? key,
|
||||||
|
required this.provider,
|
||||||
|
required this.timeToMarathon,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final TextStyle styleTextHome = TextStyle(
|
||||||
|
color: MyColors.white.withOpacity(0.45),
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
letterSpacing: -0.4,
|
||||||
|
);
|
||||||
|
|
||||||
|
final TextStyle styleDigitHome = TextStyle(
|
||||||
|
height: 22 / 27,
|
||||||
|
color: MyColors.white,
|
||||||
|
fontSize: isTablet ? 30 : 15,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
letterSpacing: -1.44,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
|
||||||
|
final TextStyle styleTextMarathon = const TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
fontStyle: FontStyle.normal,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: MyColors.grey57Color,
|
||||||
|
letterSpacing: -0.4,
|
||||||
|
);
|
||||||
|
|
||||||
|
final TextStyle styleDigitMarathon = const TextStyle(
|
||||||
|
height: 23 / 24,
|
||||||
|
color: MyColors.darkTextColor,
|
||||||
|
fontSize: 34,
|
||||||
|
letterSpacing: -1.44,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget buildSeparator() {
|
||||||
|
return AutoSizeText(
|
||||||
|
" : ",
|
||||||
|
maxFontSize: 24,
|
||||||
|
minFontSize: 20,
|
||||||
|
style: styleDigitMarathon,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getTimeDigit(String text) {
|
||||||
|
return AutoSizeText(
|
||||||
|
text,
|
||||||
|
maxFontSize: 24,
|
||||||
|
minFontSize: 20,
|
||||||
|
style: styleDigitMarathon,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getTimeText(String text) {
|
||||||
|
return AutoSizeText(
|
||||||
|
text,
|
||||||
|
minFontSize: 7,
|
||||||
|
maxFontSize: 8,
|
||||||
|
style: styleTextMarathon,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildEmptyWidget() {
|
||||||
|
return Directionality(
|
||||||
|
textDirection: ui.TextDirection.ltr,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
getTimeDigit("00"),
|
||||||
|
getTimeText(LocaleKeys.days.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
getTimeDigit("00"),
|
||||||
|
getTimeText(LocaleKeys.hours.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
getTimeDigit("00"),
|
||||||
|
getTimeText(LocaleKeys.minutes.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
getTimeDigit("00"),
|
||||||
|
getTimeText(LocaleKeys.seconds.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildCountdownTimer(CurrentRemainingTime? time) {
|
||||||
|
if (time == null) {
|
||||||
|
if (!provider.itsMarathonTime) {
|
||||||
|
scheduleMicrotask(() {
|
||||||
|
provider.itsMarathonTime = true;
|
||||||
|
provider.isButtonEnabled = true;
|
||||||
|
provider.startTimerToWaitForMarathon();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider.itsMarathonTime
|
||||||
|
? Directionality(
|
||||||
|
textDirection: ui.TextDirection.ltr,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
getTimeDigit(provider.totalSecondsToWaitForMarathon.toString()),
|
||||||
|
getTimeText(LocaleKeys.seconds.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: buildEmptyWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Directionality(
|
||||||
|
textDirection: ui.TextDirection.ltr,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
time.days == null ? getTimeDigit("00") : getTimeDigit(time.days! < 10 ? "0${time.days.toString()}" : time.days.toString()),
|
||||||
|
getTimeText(LocaleKeys.days.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
time.hours == null ? getTimeDigit("00") : getTimeDigit(time.hours! < 10 ? "0${time.hours.toString()}" : time.hours.toString()),
|
||||||
|
getTimeText(LocaleKeys.hours.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
time.min == null ? getTimeDigit("00") : getTimeDigit(time.min! < 10 ? "0${time.min.toString()}" : time.min.toString()),
|
||||||
|
getTimeText(LocaleKeys.minutes.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildSeparator(),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
time.sec == null ? getTimeDigit("00") : getTimeDigit(time.sec! < 10 ? "0${time.sec.toString()}" : time.sec.toString()),
|
||||||
|
getTimeText(LocaleKeys.seconds.tr()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CountdownTimer(
|
||||||
|
endTime: timeToMarathon,
|
||||||
|
onEnd: null,
|
||||||
|
widgetBuilder: (BuildContext context, CurrentRemainingTime? time) {
|
||||||
|
return buildCountdownTimer(time);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,93 +0,0 @@
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_svg/svg.dart';
|
|
||||||
import 'package:lottie/lottie.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/lottie_consts.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
||||||
|
|
||||||
class WinnerScreen extends StatelessWidget {
|
|
||||||
const WinnerScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: MyColors.backgroundColor,
|
|
||||||
appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()),
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
60.height,
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
decoration: MyDecorations.shadowDecoration,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
SizedBox(
|
|
||||||
height: 200,
|
|
||||||
child: Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
Lottie.asset(
|
|
||||||
MyLottieConsts.celebrate1Lottie,
|
|
||||||
height: 200,
|
|
||||||
),
|
|
||||||
Lottie.asset(
|
|
||||||
MyLottieConsts.celebrate2Lottie,
|
|
||||||
height: 200,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
26.height,
|
|
||||||
SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
"assets/images/winner_ribbon.svg",
|
|
||||||
height: 50,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: "WINNER".toText32(color: MyColors.white, isBold: true).paddingOnly(top: 07),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
12.height,
|
|
||||||
"Muhammad Shrouff".toText22(color: MyColors.grey3AColor),
|
|
||||||
"837436".toText22(color: MyColors.grey57Color),
|
|
||||||
80.height,
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
LocaleKeys.sponsoredBy.tr().toText14(color: MyColors.grey77Color),
|
|
||||||
" Extra".toText14(color: MyColors.darkTextColor, isBold: true),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
5.height,
|
|
||||||
Image.asset(
|
|
||||||
"assets/images/logos/main_mohemm_logo.png",
|
|
||||||
height: 40,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
width: 150,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).paddingOnly(left: 21, right: 21),
|
|
||||||
10.height,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue