2022-10-27 00:26:40 +00:00
|
|
|
import 'dart:async';
|
|
|
|
|
2022-10-07 23:13:02 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2022-10-10 03:36:43 +00:00
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
2022-10-13 16:00:00 +00:00
|
|
|
import 'package:stackwallet/pages_desktop_specific/create_password/create_password_view.dart';
|
2022-10-11 14:15:51 +00:00
|
|
|
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
2022-10-10 16:35:20 +00:00
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
2022-10-11 14:15:51 +00:00
|
|
|
import 'package:stackwallet/utilities/constants.dart';
|
2022-10-27 00:26:40 +00:00
|
|
|
import 'package:stackwallet/utilities/prefs.dart';
|
2022-10-07 23:13:02 +00:00
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
|
|
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
2022-10-10 16:35:20 +00:00
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
2022-10-07 23:13:02 +00:00
|
|
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|
|
|
|
2022-10-27 00:26:40 +00:00
|
|
|
import '../hive/db.dart';
|
|
|
|
import '../providers/global/price_provider.dart';
|
|
|
|
import '../services/exchange/exchange_data_loading_service.dart';
|
|
|
|
|
2022-10-07 23:13:02 +00:00
|
|
|
class StackPrivacyCalls extends ConsumerStatefulWidget {
|
|
|
|
const StackPrivacyCalls({
|
|
|
|
Key? key,
|
2022-10-10 19:49:53 +00:00
|
|
|
required this.isSettings,
|
2022-10-07 23:13:02 +00:00
|
|
|
}) : super(key: key);
|
|
|
|
|
2022-10-10 19:49:53 +00:00
|
|
|
final bool isSettings;
|
|
|
|
|
2022-10-07 23:13:02 +00:00
|
|
|
static const String routeName = "/stackPrivacy";
|
|
|
|
|
|
|
|
@override
|
|
|
|
ConsumerState<StackPrivacyCalls> createState() => _StackPrivacyCalls();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _StackPrivacyCalls extends ConsumerState<StackPrivacyCalls> {
|
2022-10-10 03:36:43 +00:00
|
|
|
late final bool isDesktop;
|
2022-10-17 20:15:25 +00:00
|
|
|
late bool isEasy;
|
|
|
|
late bool infoToggle;
|
2022-10-07 23:13:02 +00:00
|
|
|
|
2022-10-10 03:36:43 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
isDesktop = Util.isDesktop;
|
2022-10-17 20:15:25 +00:00
|
|
|
isEasy = ref.read(prefsChangeNotifierProvider).externalCalls;
|
|
|
|
infoToggle = isEasy;
|
2022-10-10 03:36:43 +00:00
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
2022-10-07 23:13:02 +00:00
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
appBar: AppBar(
|
|
|
|
leading: AppBarBackButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: SafeArea(
|
2022-10-17 20:15:25 +00:00
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 40, 0, 0),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"Choose your Stack experience",
|
|
|
|
style: STextStyles.pageTitleH1(context),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"You can change it later in Settings",
|
|
|
|
style: STextStyles.subtitle(context),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 36,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
),
|
|
|
|
child: PrivacyToggle(
|
|
|
|
externalCallsEnabled: isEasy,
|
|
|
|
onChanged: (externalCalls) {
|
|
|
|
isEasy = externalCalls;
|
|
|
|
setState(() {
|
|
|
|
infoToggle = isEasy;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 36,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
child: RoundedWhiteContainer(
|
|
|
|
child: Center(
|
|
|
|
child: RichText(
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
text: TextSpan(
|
|
|
|
style:
|
|
|
|
STextStyles.label(context).copyWith(fontSize: 12.0),
|
|
|
|
children: infoToggle
|
|
|
|
? [
|
|
|
|
const TextSpan(
|
|
|
|
text:
|
|
|
|
"Exchange data preloaded for a seamless experience."),
|
|
|
|
const TextSpan(
|
|
|
|
text:
|
|
|
|
"\n\nCoinGecko enabled: (24 hour price change shown in-app, total wallet value shown in USD or other currency)."),
|
|
|
|
TextSpan(
|
|
|
|
text:
|
|
|
|
"\n\nRecommended for most crypto users.",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textDark,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
: [
|
|
|
|
const TextSpan(
|
|
|
|
text:
|
|
|
|
"Exchange data not preloaded (slower experience)."),
|
|
|
|
const TextSpan(
|
|
|
|
text:
|
|
|
|
"\n\nCoinGecko disabled (price changes not shown, no wallet value shown in other currencies)."),
|
|
|
|
TextSpan(
|
|
|
|
text:
|
|
|
|
"\n\nRecommended for the privacy conscious.",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textDark,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-10-07 23:13:02 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
const Spacer(
|
|
|
|
flex: 4,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
vertical: 16,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: ContinueButton(
|
|
|
|
isDesktop: isDesktop,
|
|
|
|
label: !widget.isSettings ? "Continue" : "Save changes",
|
|
|
|
onPressed: () {
|
|
|
|
ref.read(prefsChangeNotifierProvider).externalCalls =
|
|
|
|
isEasy;
|
2022-10-27 00:26:40 +00:00
|
|
|
|
|
|
|
DB.instance
|
|
|
|
.put<dynamic>(
|
|
|
|
boxName: DB.boxNamePrefs,
|
|
|
|
key: "externalCalls",
|
|
|
|
value: isEasy)
|
|
|
|
.then((_) {
|
|
|
|
if (isEasy) {
|
|
|
|
unawaited(
|
|
|
|
ExchangeDataLoadingService().loadAll(ref));
|
|
|
|
ref
|
|
|
|
.read(priceAnd24hChangeNotifierProvider)
|
|
|
|
.start(true);
|
|
|
|
}
|
|
|
|
});
|
2022-10-17 20:15:25 +00:00
|
|
|
if (!widget.isSettings) {
|
|
|
|
if (isDesktop) {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
CreatePasswordView.routeName,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
CreatePinView.routeName,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Navigator.pop(context);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
2022-10-10 16:35:20 +00:00
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
],
|
|
|
|
),
|
2022-10-10 16:35:20 +00:00
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
],
|
|
|
|
),
|
2022-10-07 23:13:02 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2022-10-10 03:36:43 +00:00
|
|
|
|
2022-10-17 20:15:25 +00:00
|
|
|
class PrivacyToggle extends StatefulWidget {
|
|
|
|
const PrivacyToggle({
|
|
|
|
Key? key,
|
|
|
|
required this.externalCallsEnabled,
|
|
|
|
this.onChanged,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final bool externalCallsEnabled;
|
|
|
|
final void Function(bool)? onChanged;
|
2022-10-11 14:15:51 +00:00
|
|
|
|
|
|
|
@override
|
2022-10-17 20:15:25 +00:00
|
|
|
State<PrivacyToggle> createState() => _PrivacyToggleState();
|
2022-10-11 14:15:51 +00:00
|
|
|
}
|
|
|
|
|
2022-10-17 20:15:25 +00:00
|
|
|
class _PrivacyToggleState extends State<PrivacyToggle> {
|
|
|
|
late bool externalCallsEnabled;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// initial toggle state
|
|
|
|
externalCallsEnabled = widget.externalCallsEnabled;
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
2022-10-11 14:15:51 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: RawMaterialButton(
|
|
|
|
fillColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
|
|
|
shape: RoundedRectangleBorder(
|
2022-10-17 20:15:25 +00:00
|
|
|
side: !externalCallsEnabled
|
2022-10-11 17:36:07 +00:00
|
|
|
? BorderSide.none
|
|
|
|
: BorderSide(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemIcons,
|
|
|
|
width: 2,
|
|
|
|
),
|
2022-10-11 14:15:51 +00:00
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius * 2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
2022-10-17 20:15:25 +00:00
|
|
|
setState(() {
|
|
|
|
// update toggle state
|
|
|
|
externalCallsEnabled = true;
|
|
|
|
});
|
|
|
|
// call callback with newly set value
|
|
|
|
widget.onChanged?.call(externalCallsEnabled);
|
2022-10-11 14:15:51 +00:00
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(
|
|
|
|
12,
|
|
|
|
),
|
2022-10-11 17:36:07 +00:00
|
|
|
child: Stack(
|
2022-10-11 14:15:51 +00:00
|
|
|
children: [
|
2022-10-11 17:36:07 +00:00
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
2022-10-19 15:34:04 +00:00
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.personaEasy,
|
|
|
|
width: 140,
|
|
|
|
height: 140,
|
2022-10-11 17:36:07 +00:00
|
|
|
),
|
2022-10-11 21:28:56 +00:00
|
|
|
Center(
|
2022-10-11 17:36:07 +00:00
|
|
|
child: Text(
|
|
|
|
"Easy Crypto",
|
2022-10-11 21:28:56 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
2022-10-11 17:36:07 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
)),
|
2022-10-11 21:28:56 +00:00
|
|
|
Center(
|
2022-10-11 17:36:07 +00:00
|
|
|
child: Text(
|
|
|
|
"Recommended",
|
2022-10-11 21:28:56 +00:00
|
|
|
style: STextStyles.label(context),
|
2022-10-11 17:36:07 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-10-10 16:35:20 +00:00
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
if (externalCallsEnabled)
|
2022-10-11 17:36:07 +00:00
|
|
|
Positioned(
|
|
|
|
top: 4,
|
|
|
|
right: 4,
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
Assets.svg.checkCircle,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemIcons,
|
|
|
|
),
|
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
if (!externalCallsEnabled)
|
2022-10-11 17:36:07 +00:00
|
|
|
Positioned(
|
|
|
|
top: 4,
|
|
|
|
right: 4,
|
|
|
|
child: Container(
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldDefaultBG,
|
|
|
|
),
|
|
|
|
),
|
2022-10-11 14:15:51 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: RawMaterialButton(
|
|
|
|
elevation: 0,
|
|
|
|
fillColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
|
|
|
shape: RoundedRectangleBorder(
|
2022-10-17 20:15:25 +00:00
|
|
|
side: externalCallsEnabled
|
2022-10-11 14:15:51 +00:00
|
|
|
? BorderSide.none
|
|
|
|
: BorderSide(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemIcons,
|
|
|
|
width: 2,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius * 2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
2022-10-17 20:15:25 +00:00
|
|
|
setState(() {
|
|
|
|
// update toggle state
|
|
|
|
externalCallsEnabled = false;
|
|
|
|
});
|
|
|
|
// call callback with newly set value
|
|
|
|
widget.onChanged?.call(externalCallsEnabled);
|
2022-10-11 14:15:51 +00:00
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(
|
|
|
|
12,
|
|
|
|
),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
2022-10-19 15:34:04 +00:00
|
|
|
SvgPicture.asset(
|
|
|
|
Assets.svg.personaIncognito,
|
|
|
|
width: 140,
|
|
|
|
height: 140,
|
2022-10-11 14:15:51 +00:00
|
|
|
),
|
2022-10-11 21:28:56 +00:00
|
|
|
Center(
|
2022-10-11 14:15:51 +00:00
|
|
|
child: Text(
|
|
|
|
"Incognito",
|
2022-10-11 21:28:56 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
2022-10-11 14:15:51 +00:00
|
|
|
fontWeight: FontWeight.bold,
|
2022-10-10 16:35:20 +00:00
|
|
|
),
|
|
|
|
),
|
2022-10-07 23:13:02 +00:00
|
|
|
),
|
2022-10-11 21:28:56 +00:00
|
|
|
Center(
|
2022-10-11 14:15:51 +00:00
|
|
|
child: Text(
|
|
|
|
"Privacy conscious",
|
2022-10-11 21:28:56 +00:00
|
|
|
style: STextStyles.label(context),
|
2022-10-11 14:15:51 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
2022-10-10 03:36:43 +00:00
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
if (!externalCallsEnabled)
|
2022-10-11 14:15:51 +00:00
|
|
|
Positioned(
|
|
|
|
top: 4,
|
|
|
|
right: 4,
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
Assets.svg.checkCircle,
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.infoItemIcons,
|
|
|
|
),
|
|
|
|
),
|
2022-10-17 20:15:25 +00:00
|
|
|
if (externalCallsEnabled)
|
2022-10-11 14:15:51 +00:00
|
|
|
Positioned(
|
|
|
|
top: 4,
|
|
|
|
right: 4,
|
|
|
|
child: Container(
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(1000),
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textFieldDefaultBG,
|
2022-10-10 03:36:43 +00:00
|
|
|
),
|
2022-10-11 14:15:51 +00:00
|
|
|
),
|
2022-10-10 16:35:20 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-07 23:13:02 +00:00
|
|
|
),
|
2022-10-11 14:15:51 +00:00
|
|
|
),
|
2022-10-07 23:13:02 +00:00
|
|
|
),
|
2022-10-11 14:15:51 +00:00
|
|
|
],
|
2022-10-07 23:13:02 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2022-10-10 03:36:43 +00:00
|
|
|
|
2022-10-14 19:40:44 +00:00
|
|
|
class ContinueButton extends ConsumerWidget {
|
|
|
|
const ContinueButton({
|
|
|
|
Key? key,
|
|
|
|
required this.isDesktop,
|
2022-10-19 15:34:04 +00:00
|
|
|
required this.onPressed,
|
|
|
|
required this.label,
|
2022-10-14 19:40:44 +00:00
|
|
|
}) : super(key: key);
|
2022-10-10 03:36:43 +00:00
|
|
|
|
2022-10-17 20:15:25 +00:00
|
|
|
final String label;
|
2022-10-10 03:36:43 +00:00
|
|
|
final bool isDesktop;
|
2022-10-17 20:15:25 +00:00
|
|
|
final VoidCallback onPressed;
|
2022-10-10 03:36:43 +00:00
|
|
|
|
|
|
|
@override
|
2022-10-14 19:40:44 +00:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
2022-10-19 15:34:04 +00:00
|
|
|
if (isDesktop) {
|
|
|
|
return SizedBox(
|
|
|
|
width: 328,
|
|
|
|
height: 70,
|
|
|
|
child: TextButton(
|
|
|
|
style: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.getPrimaryEnabledButtonColor(context),
|
|
|
|
onPressed: onPressed,
|
|
|
|
child: Text(
|
|
|
|
label,
|
|
|
|
style: STextStyles.button(context).copyWith(fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return TextButton(
|
|
|
|
style: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.getPrimaryEnabledButtonColor(context),
|
|
|
|
onPressed: onPressed,
|
|
|
|
child: Text(
|
|
|
|
label,
|
|
|
|
style: STextStyles.button(context),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2022-10-10 03:36:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-11 16:34:36 +00:00
|
|
|
// class CustomRadio extends StatefulWidget {
|
|
|
|
// CustomRadio(this.upperCall, {Key? key}) : super(key: key);
|
|
|
|
//
|
|
|
|
// Function upperCall;
|
|
|
|
//
|
|
|
|
// @override
|
|
|
|
// createState() {
|
|
|
|
// return CustomRadioState();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// class CustomRadioState extends State<CustomRadio> {
|
|
|
|
// List<RadioModel> sampleData = <RadioModel>[];
|
|
|
|
//
|
|
|
|
// @override
|
|
|
|
// void initState() {
|
|
|
|
// super.initState();
|
|
|
|
// sampleData.add(
|
|
|
|
// RadioModel(true, Assets.svg.personaEasy, 'Easy Crypto', 'Recommended'));
|
|
|
|
// sampleData.add(RadioModel(
|
|
|
|
// false, Assets.svg.personaIncognito, 'Incognito', 'Privacy conscious'));
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// @override
|
|
|
|
// Widget build(BuildContext context) {
|
|
|
|
// return Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// // if (!sampleData[0].isSelected) {
|
|
|
|
// widget.upperCall.call(true);
|
|
|
|
// // }
|
|
|
|
// for (var element in sampleData) {
|
|
|
|
// element.isSelected = false;
|
|
|
|
// }
|
|
|
|
// sampleData[0].isSelected = true;
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: RadioItem(sampleData[0]),
|
|
|
|
// ),
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// // if (!sampleData[1].isSelected) {
|
|
|
|
// widget.upperCall.call(false);
|
|
|
|
// // }
|
|
|
|
// for (var element in sampleData) {
|
|
|
|
// element.isSelected = false;
|
|
|
|
// }
|
|
|
|
// sampleData[1].isSelected = true;
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: RadioItem(sampleData[1]),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// class RadioItem extends StatelessWidget {
|
|
|
|
// final RadioModel _item;
|
|
|
|
// const RadioItem(this._item, {Key? key}) : super(key: key);
|
|
|
|
// @override
|
|
|
|
// Widget build(BuildContext context) {
|
|
|
|
// return Container(
|
|
|
|
// margin: const EdgeInsets.all(15.0),
|
|
|
|
// child: RoundedWhiteContainer(
|
|
|
|
// borderColor: _item.isSelected ? const Color(0xFF0056D2) : null,
|
|
|
|
// child: Center(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// SvgPicture.asset(
|
|
|
|
// _item.svg,
|
|
|
|
// // color: Theme.of(context).extension<StackColors>()!.textWhite,
|
|
|
|
// width: 140,
|
|
|
|
// height: 140,
|
|
|
|
// ),
|
|
|
|
// RichText(
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
// text: TextSpan(
|
|
|
|
// style: STextStyles.label(context).copyWith(fontSize: 12.0),
|
|
|
|
// children: [
|
|
|
|
// TextSpan(
|
|
|
|
// text: _item.topText,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: Theme.of(context)
|
|
|
|
// .extension<StackColors>()!
|
|
|
|
// .textDark,
|
|
|
|
// fontWeight: FontWeight.bold)),
|
|
|
|
// TextSpan(text: "\n${_item.bottomText}"),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// class RadioModel {
|
|
|
|
// bool isSelected;
|
|
|
|
// final String svg;
|
|
|
|
// final String topText;
|
|
|
|
// final String bottomText;
|
|
|
|
//
|
|
|
|
// RadioModel(this.isSelected, this.svg, this.topText, this.bottomText);
|
|
|
|
// }
|