buildPopUp static method
Widget
buildPopUp(
- BuildContext context,
- AppUpdateData appUpdateData,
- bool isDarkMode,
- void onClickUpdate(),
- void onClickReminder(),
- void onClickIgnore(),
- void checkIsBack(),
Implementation
static Widget buildPopUp(
BuildContext context,
AppUpdateData appUpdateData,
bool isDarkMode,
void Function() onClickUpdate,
void Function() onClickReminder,
void Function() onClickIgnore,
void Function(bool) checkIsBack) {
String imageSource;
if (isDarkMode) {
imageSource = 'assets/images-dark/ic_version_alert.png';
} else {
imageSource = 'assets/images/ic_version_alert.png';
}
List<Widget> actionWidgetList = <Widget>[
ElevatedButton(
onPressed: () {
onClickUpdate();
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 60.0),
shape: const StadiumBorder()),
child: Text(appUpdateData.updateNowText),
),
const SizedBox(height: 15.0)
];
final remindMeTextButton = TextButton(
onPressed: () {
onClickReminder();
Navigator.pop(context);
},
style: TextButton.styleFrom(),
child: Text(appUpdateData.remindMeLaterText),
);
final ignoreTextButton = TextButton(
onPressed: () {
onClickIgnore();
Navigator.pop(context);
},
style: TextButton.styleFrom(),
child: Text(appUpdateData.neverAgainText));
checkIsBack(false);
if (appUpdateData.option == "1") {
actionWidgetList.add(remindMeTextButton);
actionWidgetList.add(ignoreTextButton);
checkIsBack(true);
} else if (appUpdateData.option == "2") {
actionWidgetList.add(remindMeTextButton);
}
return SizedBox(
width: double.infinity,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image(
image:
AssetImage(imageSource, package: 'apptics_flutter'),
fit: BoxFit.cover),
const SizedBox(height: 25),
Text(
appUpdateData.featureTitle,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 18.0),
),
const SizedBox(height: 25),
SingleChildScrollView(
child: Text(
appUpdateData.features,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16.0),
),
),
],
),
),
const SizedBox(height: 50),
SizedBox(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: actionWidgetList,
),
)
],
),
),
);
}