94 lines
2.8 KiB
Dart
94 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:in_app_update/in_app_update.dart';
|
|
import 'dart:io';
|
|
import '../theme/app_theme.dart';
|
|
|
|
class UpdateRequiredScreen extends StatelessWidget {
|
|
const UpdateRequiredScreen({super.key});
|
|
|
|
Future<void> _triggerNativeUpdate() async {
|
|
try {
|
|
if (Platform.isAndroid) {
|
|
await InAppUpdate.performImmediateUpdate();
|
|
}
|
|
} catch (_) {}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.scaffold,
|
|
body: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Illustration or Icon
|
|
Container(
|
|
width: 120,
|
|
height: 120,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFEFF4FF),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: const Icon(
|
|
Icons.system_update_rounded,
|
|
size: 50,
|
|
color: AppColors.primary,
|
|
),
|
|
),
|
|
const SizedBox(height: 32),
|
|
|
|
// Text Content
|
|
const Text(
|
|
'Update Required',
|
|
style: TextStyle(
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w800,
|
|
color: AppColors.darkBlue,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'A new version of Doormile CRM is available. You must update to the latest version to continue using the app securely.',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
height: 1.5,
|
|
color: AppColors.textSecondary,
|
|
),
|
|
),
|
|
const SizedBox(height: 48),
|
|
|
|
// Update Button
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 54,
|
|
child: ElevatedButton(
|
|
onPressed: _triggerNativeUpdate,
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppColors.primary,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
elevation: 0,
|
|
),
|
|
child: const Text(
|
|
'Update Now',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|