Skip to content

Commit

Permalink
revamp: move quiz tnc mulai button to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
reorr committed Apr 23, 2024
1 parent 05de3df commit 0d5a45f
Showing 1 changed file with 45 additions and 40 deletions.
85 changes: 45 additions & 40 deletions app/lib/features/quiz_start/presentation/pages/quiz_start_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _QuizStartPageState extends State<QuizStartPage> {
const SizedBox(
height: 20,
),
BlocBuilder<QuizStartCubit, QuizStartState>(
Expanded(child: BlocBuilder<QuizStartCubit, QuizStartState>(
builder: (context, state) {
if (state is QuizStartSuccess) {
return buildSuccessState(state);
Expand All @@ -105,7 +105,7 @@ class _QuizStartPageState extends State<QuizStartPage> {
child: CircularProgressIndicator(),
);
},
),
)),
],
),
),
Expand All @@ -118,6 +118,7 @@ class _QuizStartPageState extends State<QuizStartPage> {

Widget buildSuccessState(QuizStartSuccess state) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Expand Down Expand Up @@ -178,6 +179,46 @@ class _QuizStartPageState extends State<QuizStartPage> {
height: 10,
),
buildTnC(),
const SizedBox(
height: 10,
),
Row(
children: [
Checkbox(
value: state.agreement,
onChanged: (state.participation.attempts.length <
state.participation.quiz_max_attempts)
? (value) {
if (value != null) {
context
.read<QuizStartCubit>()
.setAgreement(value: value);
}
}
: null,
activeColor: const Color(0xFF1BB8E1),
),
Flexible(
child: GestureDetector(
onTap: () {
if (state.participation.attempts.length <
state.participation.quiz_max_attempts) {
final newValue = !state.agreement;
context
.read<QuizStartCubit>()
.setAgreement(value: newValue);
}
},
child: const Text(
'Saya telah membaca peraturan & akan mengerjakan dengan jujur',
style: TextStyle(
fontSize: 13,
),
),
),
),
],
),
],
),
),
Expand All @@ -192,43 +233,6 @@ class _QuizStartPageState extends State<QuizStartPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
Checkbox(
value: state.agreement,
onChanged: (state.participation.attempts.length <
state.participation.quiz_max_attempts)
? (value) {
if (value != null) {
context
.read<QuizStartCubit>()
.setAgreement(value: value);
}
}
: null,
activeColor: const Color(0xFF1BB8E1),
),
Flexible(
child: GestureDetector(
onTap: () {
if (state.participation.attempts.length <
state.participation.quiz_max_attempts) {
final newValue = !state.agreement;
context
.read<QuizStartCubit>()
.setAgreement(value: newValue);
}
},
child: const Text(
'Saya telah membaca peraturan & akan mengerjakan dengan jujur',
style: TextStyle(
fontSize: 13,
),
),
),
),
],
),
Button(
isDisabled: !state.agreement ||
state.participation.attempts.length >=
Expand All @@ -248,8 +252,9 @@ class _QuizStartPageState extends State<QuizStartPage> {
customButtonColor: const Color(0xFF1BB8E1),
customTextColor: Colors.white,
text: 'Mulai',
innerVerticalPadding: 12,
borderRadius: 4,
),
)
],
),
),
Expand Down

0 comments on commit 0d5a45f

Please sign in to comment.