quite a few UX improvements
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:anyway/structs/agreement.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
|
||||
@@ -26,7 +27,6 @@ class OnboardingAgreementCard extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OnboardingAgreementCardState extends State<OnboardingAgreementCard> {
|
||||
bool agreed = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
@@ -39,21 +39,42 @@ class _OnboardingAgreementCardState extends State<OnboardingAgreementCard> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: agreed,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
agreed = value!;
|
||||
widget.onAgreementChanged(value);
|
||||
});
|
||||
// The checkbox of the agreement
|
||||
FutureBuilder(
|
||||
future: getAgreement(),
|
||||
builder: (context, snapshot) {
|
||||
bool agreed = false;
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasData) {
|
||||
Agreement agreement = snapshot.data!;
|
||||
agreed = agreement.agreed;
|
||||
} else {
|
||||
agreed = false;
|
||||
}
|
||||
} else {
|
||||
agreed = false;
|
||||
}
|
||||
return Checkbox(
|
||||
value: agreed,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.onAgreementChanged(value!);
|
||||
});
|
||||
saveAgreement(value!);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// The text of the agreement
|
||||
Text(
|
||||
"I agree to the ",
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
// The clickable text of the agreement that shows the agreement text
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// show a dialog with the agreement text
|
||||
|
Reference in New Issue
Block a user