marathon improvements.

sultan-dev
Sikander Saleem 2 years ago
parent 7f2aa4415d
commit 7d651c247a

@ -1,7 +1,7 @@
class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";

@ -136,7 +136,7 @@ extension EmailValidator on String {
Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text(
this,
maxLines: maxlines,
style: TextStyle(color: color ?? MyColors.grey3AColor, fontSize: 21, letterSpacing: -0.31, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)),
style: TextStyle(color: color ?? MyColors.grey3AColor, fontSize: 21, letterSpacing: -0.84, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)),
);
Widget toText22({Color? color, bool isBold = false}) => Text(
@ -149,6 +149,11 @@ extension EmailValidator on String {
style: TextStyle(height: 23 / 24, color: color ?? MyColors.darkTextColor, fontSize: 24, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
);
Widget toText30({Color? color, bool isBold = false}) => Text(
this,
style: TextStyle(height: 20 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.2, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),
);
Widget toText32({Color? color, bool isBold = false}) => Text(
this,
style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.92, fontWeight: isBold ? FontWeight.bold : FontWeight.w600),

@ -313,7 +313,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
],
).paddingOnly(left: 21, right: 21, top: 7),
const MarathonBanner().paddingAll(20),
const MarathonBanner().paddingAll(21),
ServicesWidget(),
// 8.height,
Container(

@ -25,26 +25,18 @@ class MarathonIntroScreen extends StatelessWidget {
MarathonProvider provider = context.watch<MarathonProvider>();
return Scaffold(
appBar: AppBarWidget(context, title: LocaleKeys.brainMarathon.tr()),
body: Stack(
body: Column(
children: <Widget>[
SingleChildScrollView(
child: Column(
children: <Widget>[
MarathonDetailsCard(provider: provider).paddingAll(15),
MarathonTimerCard(
provider: provider,
timeToMarathon: dummyEndTime,
).paddingOnly(left: 15, right: 15, bottom: 15),
const SizedBox(
height: 100,
),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: MarathonFooter(provider: provider),
),
ListView(
padding: const EdgeInsets.all(21),
children: <Widget>[
MarathonDetailsCard(provider: provider),
10.height,
MarathonTimerCard(provider: provider, timeToMarathon: dummyEndTime),
],
).expanded,
1.divider,
MarathonFooter(provider: provider),
],
),
);
@ -61,52 +53,41 @@ class MarathonDetailsCard extends StatelessWidget {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 14),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color),
"Saudi Arabia".toText20(color: MyColors.textMixColor, isBold: true),
Row(
children: <Widget>[
Flexible(
child: "Nam suscipit turpis in pharetra euismsdef. Duis rutrum at nulla id aliquam".toText14(color: MyColors.grey77Color),
)
],
),
if (provider.itsMarathonTime) ...<Widget>[
5.height,
Row(
children: <Widget>[
LocaleKeys.prize.tr().toText16(color: MyColors.grey77Color, isBold: true),
" LED 55\" Android TV".toText16(color: MyColors.greenColor, isBold: true),
],
),
Row(
children: <Widget>[
LocaleKeys.sponsoredBy.tr().toText16(color: MyColors.grey77Color),
" Extra".toText16(color: MyColors.darkTextColor, isBold: true),
],
),
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/images/logos/main_mohemm_logo.png",
height: 40,
fit: BoxFit.fill,
width: 150,
)
],
),
]
],
),
LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey57Color),
"Saudi Arabia".toText20(color: MyColors.textMixColor),
"Nam suscipit turpis in pharetra euismsdef. Duis rutrum at nulla id aliquam".toText14(color: MyColors.grey57Color, weight: FontWeight.w500),
if (provider.itsMarathonTime) ...<Widget>[
5.height,
Row(
children: <Widget>[
LocaleKeys.prize.tr().toText16(color: MyColors.grey57Color),
" LED 55\" Android TV".toText16(color: MyColors.greenColor, isBold: true),
],
),
Row(
children: <Widget>[
LocaleKeys.sponsoredBy.tr().toText16(color: MyColors.grey57Color),
" Extra".toText16(color: MyColors.darkTextColor),
],
),
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/images/logos/main_mohemm_logo.png",
height: 40,
fit: BoxFit.fill,
width: 150,
)
],
),
]
],
),
);
@ -128,30 +109,23 @@ class MarathonTimerCard extends StatelessWidget {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 14),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
LocaleKeys.gameDate.tr().toText16(color: MyColors.grey77Color),
" 10 Oct, 2022".toText16(color: MyColors.darkTextColor, isBold: true),
LocaleKeys.gameDate.tr().toText16(color: MyColors.grey57Color),
" 10 Oct, 2022".toText16(color: MyColors.darkTextColor),
],
),
Row(
children: <Widget>[
LocaleKeys.gameTime.tr().toText16(color: MyColors.grey77Color),
" 3:00pm".toText16(color: MyColors.darkTextColor, isBold: true),
LocaleKeys.gameTime.tr().toText16(color: MyColors.grey57Color),
" 3:00 pm".toText16(color: MyColors.darkTextColor),
],
),
Lottie.asset(
MyLottieConsts.hourGlassLottie,
height: 200,
),
BuildCountdownTimer(
timeToMarathon: timeToMarathon,
provider: provider,
screenFlag: 1,
),
Lottie.asset(MyLottieConsts.hourGlassLottie, height: 200),
BuildCountdownTimer(timeToMarathon: timeToMarathon, provider: provider, screenFlag: 1),
],
),
);
@ -172,38 +146,19 @@ class MarathonFooter extends StatelessWidget {
children: <InlineSpan>[
TextSpan(
text: LocaleKeys.note.tr(),
style: const TextStyle(
color: MyColors.darkTextColor,
fontSize: 17,
letterSpacing: -0.64,
fontWeight: FontWeight.bold,
),
style: const TextStyle(color: MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.bold),
),
TextSpan(
text: " " + LocaleKeys.demoMarathonNoteP1.tr(),
style: const TextStyle(
color: MyColors.grey77Color,
fontSize: 17,
letterSpacing: -0.64,
fontWeight: FontWeight.w500,
),
style: const TextStyle(color: MyColors.grey77Color, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.w500),
),
TextSpan(
text: " " + LocaleKeys.demoMarathonNoteP2.tr(),
style: const TextStyle(
color: MyColors.darkTextColor,
fontSize: 17,
fontWeight: FontWeight.bold,
),
style: const TextStyle(color: MyColors.darkTextColor, fontSize: 17, fontWeight: FontWeight.bold),
),
TextSpan(
text: " " + LocaleKeys.demoMarathonNoteP3.tr(),
style: const TextStyle(
color: MyColors.grey77Color,
fontSize: 17,
letterSpacing: -0.64,
fontWeight: FontWeight.w500,
),
style: const TextStyle(color: MyColors.grey77Color, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.w500),
)
],
),

@ -60,7 +60,7 @@ class MarathonProvider extends ChangeNotifier {
oneSec,
(Timer timer) async {
if (start == 0) {
if (currentQuestionNumber == 9) {
if (currentQuestionNumber == totalQuestions) {
timer.cancel();
cancelTimer();
isMarathonCompleted = true;

@ -16,8 +16,6 @@ import 'package:mohem_flutter_app/ui/marathon/widgets/custom_status_widget.dart'
import 'package:mohem_flutter_app/ui/marathon/widgets/question_card.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:provider/provider.dart';
import 'package:sizer/sizer.dart';
import 'package:steps_indicator/steps_indicator.dart';
class MarathonScreen extends StatelessWidget {
const MarathonScreen({Key? key}) : super(key: key);
@ -100,7 +98,7 @@ class _MarathonProgressContainerState extends State<MarathonProgressContainer> {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.all(21),
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 13),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
@ -108,10 +106,7 @@ class _MarathonProgressContainerState extends State<MarathonProgressContainer> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: MyColors.greenColor,
borderRadius: BorderRadius.circular(5),
),
decoration: BoxDecoration(color: MyColors.greenColor, borderRadius: BorderRadius.circular(5)),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8),
child: "${widget.provider.currentQuestionNumber.toString()} / ${widget.provider.totalQuestions.toString()} ${LocaleKeys.question.tr()}".toText12(color: MyColors.white),
),
@ -119,36 +114,50 @@ class _MarathonProgressContainerState extends State<MarathonProgressContainer> {
"00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(),
],
),
15.height,
StepsIndicator(
lineLength: SizerUtil.deviceType == DeviceType.tablet ? MediaQuery.of(context).size.width * 0.077 : MediaQuery.of(context).size.width * 0.054,
nbSteps: 10,
selectedStep: widget.provider.currentQuestionNumber,
doneLineColor: MyColors.greenColor,
doneStepColor: MyColors.greenColor,
doneLineThickness: 6,
undoneLineThickness: 6,
selectedStepSize: 10,
unselectedStepSize: 10,
doneStepSize: 10,
selectedStepBorderSize: 0,
unselectedStepBorderSize: 0,
selectedStepColorIn: MyColors.greenColor,
selectedStepColorOut: MyColors.greenColor,
unselectedStepColorIn: MyColors.lightGreyDeColor,
unselectedStepColorOut: MyColors.lightGreyDeColor,
undoneLineColor: MyColors.lightGreyDeColor,
enableLineAnimation: false,
enableStepAnimation: false,
),
12.height,
stepper(widget.provider.currentQuestionNumber),
8.height,
Row(
children: <Widget>[
"${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}".toText14(isBold: true),
"${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}".toText14(),
],
),
],
),
);
}
Widget stepper(int value) {
return SizedBox(
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
for (int i = 0; i < 10; i++)
if (value <= i) roundContainer(MyColors.lightGreyDeColor, i != 0) else roundContainer(MyColors.greenColor, i != 0)
],
),
);
}
Widget roundContainer(Color color, bool isNeedLeftBorder) {
if (isNeedLeftBorder) {
return Row(
children: [
Divider(thickness: 6, color: color).expanded,
Container(
width: 10,
height: 10,
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
),
],
).expanded;
}
return Container(
width: 10,
height: 10,
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
);
}
}

@ -29,7 +29,7 @@ class MarathonWinnerSelection extends StatelessWidget {
children: [
20.height,
QualifiersContainer(provider: provider).paddingOnly(left: 21, right: 21),
20.height,
12.height,
InkWell(
onTap: () {
Navigator.pushNamed(context, AppRoutes.marathonWinnerScreen);
@ -52,8 +52,8 @@ class MarathonWinnerSelection extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
"Muhammad Shrouff".toText18(isBold: true, color: MyColors.white),
"837436".toText18(isBold: true, color: MyColors.white),
"Muhammad Shrouff".toText17(isBold: true, color: MyColors.white),
"837436".toText17(isBold: true, color: MyColors.white),
],
),
),
@ -67,10 +67,10 @@ class MarathonWinnerSelection extends StatelessWidget {
title: Text(
LocaleKeys.fingersCrossed.tr(),
style: const TextStyle(
height: 23 / 24,
height: 27 / 27,
color: MyColors.greenColor,
fontSize: 27,
letterSpacing: -1,
letterSpacing: -1.08,
fontWeight: FontWeight.w600,
),
),
@ -78,9 +78,9 @@ class MarathonWinnerSelection extends StatelessWidget {
LocaleKeys.winnerSelectedRandomly.tr(),
textAlign: TextAlign.center,
style: const TextStyle(
color: MyColors.grey77Color,
fontSize: 16,
letterSpacing: -0.64,
color: MyColors.darkTextColor,
fontSize: 18,
letterSpacing: -0.72,
fontWeight: FontWeight.w600,
),
)).paddingOnly(left: 21, right: 21, top: 20, bottom: 20),
@ -124,22 +124,22 @@ class _QualifiersContainerState extends State<QualifiersContainer> {
return Container(
width: double.infinity,
decoration: MyDecorations.shadowDecoration,
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20),
padding: const EdgeInsets.only(top: 14,left: 18,right: 14,bottom: 18),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
LocaleKeys.winnerSelection.tr().toText18(isBold: true, color: MyColors.grey3AColor),
"00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(isBold: true, color: MyColors.redColor),
LocaleKeys.winnerSelection.tr().toText21(color: MyColors.grey3AColor),
"00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(color: MyColors.redColor),
],
),
10.height,
Row(
children: [
"18 ".toText32(color: MyColors.greenColor),
LocaleKeys.qualifiers.tr().toText20(color: MyColors.greenColor),
"18".toText30(color: MyColors.greenColor, isBold: true),2.width,
LocaleKeys.qualifiers.tr().toText16(color: MyColors.greenColor),
],
),
],

@ -60,6 +60,7 @@ class BuildCountdownTimer extends StatelessWidget {
children: <Widget>[
Column(
children: <Widget>[
// todo @faiz: Make a separate method and pass string , so we can minimize code replication
AutoSizeText(
"00",
maxFontSize: 24,
@ -155,6 +156,7 @@ class BuildCountdownTimer extends StatelessWidget {
children: <Widget>[
Column(
children: <Widget>[
// todo @faiz: Make a separate method and pass value and string , so we can minimize code replication
time.days == null
? AutoSizeText(
"00",

@ -1,3 +1,5 @@
import 'dart:math' as math;
import 'package:auto_size_text/auto_size_text.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -13,7 +15,6 @@ import 'package:mohem_flutter_app/ui/marathon/marathon_intro_screen.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:mohem_flutter_app/ui/marathon/widgets/countdown_timer.dart';
import 'package:provider/provider.dart';
import 'dart:math' as math;
class MarathonBanner extends StatelessWidget {
const MarathonBanner({Key? key}) : super(key: key);

@ -84,57 +84,39 @@ class CardContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: CupertinoColors.white,
boxShadow: <BoxShadow>[
BoxShadow(
color: CupertinoColors.systemGrey.withOpacity(0.2),
spreadRadius: 3,
blurRadius: 7,
offset: const Offset(0, 3),
)
],
),
alignment: Alignment.center,
child: Column(
children: <Widget>[
Container(
height: 78,
width: double.infinity,
decoration: const BoxDecoration(
gradient: LinearGradient(
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
height: 78,
width: double.infinity,
decoration: const BoxDecoration(
gradient: LinearGradient(
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
child: const Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 13),
child: Text(
"What is the capital of Saudi Arabia?",
style: TextStyle(
color: MyColors.white,
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
),
AnswerContent(question: question, provider: provider),
],
),
padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 17),
child: Text(
"What is the capital of Saudi Arabia?",
style: TextStyle(
color: MyColors.white,
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
AnswerContent(question: question, provider: provider),
],
);
}
}
@ -174,7 +156,7 @@ class _AnswerContentState extends State<AnswerContent> {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(13),
padding: const EdgeInsets.symmetric(vertical: 31, horizontal: 13),
decoration: const BoxDecoration(
color: MyColors.kWhiteColor,
borderRadius: BorderRadius.only(
@ -187,6 +169,7 @@ class _AnswerContentState extends State<AnswerContent> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// todo @faiz: Make a separate method and pass value and string , so we can minimize code duplication
InkWell(
onTap: () {
if (widget.provider.currentQuestionNumber == 9) {

@ -79,14 +79,10 @@ dependencies:
pull_to_refresh: ^2.0.0
# lottie json animations
lottie: any
# Steps Progress
steps_indicator: ^1.3.0
# Marathon Card Swipe
appinio_swiper: ^1.1.1
expandable: ^5.0.1
#Chat
signalr_netcore: ^1.3.3
logging: ^1.0.1

Loading…
Cancel
Save