sc-android-app/lib/screens/data_submit_successfull.dart
2024-09-29 22:09:36 +05:30

51 lines
2.1 KiB
Dart

import 'package:cheminova/screens/home_screen.dart'; // Import the home screen for navigation after submission
import 'package:cheminova/widgets/common_background.dart'; // Import custom background widget
import 'package:flutter/material.dart'; // Import Flutter material package
// Create a StatefulWidget for the success screen after data submission
class DataSubmitSuccessFullScreen extends StatefulWidget {
const DataSubmitSuccessFullScreen({super.key});
@override
State<DataSubmitSuccessFullScreen> createState() => DataSubmitSuccessFullScreenState();
}
// Define the state class for the DataSubmitSuccessFullScreen
class DataSubmitSuccessFullScreenState extends State<DataSubmitSuccessFullScreen> {
@override
void initState() {
super.initState();
// Navigate to the HomePage after a 2-second delay
Future.delayed(const Duration(seconds: 2), () {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => const HomePage()));
});
}
@override
Widget build(BuildContext context) {
// Build the UI for the success screen
return Scaffold(
body: CommonBackground( // Use the custom background widget
child: Center( // Center the content vertically and horizontally
child: Column(
mainAxisAlignment: MainAxisAlignment.center, // Center items in the column
children: [
// Display a success message
const Text('Data Submitted\nsuccessfully',
style: TextStyle(
fontSize: 36, // Set font size
color: Colors.white, // Set font color
fontWeight: FontWeight.w400, // Set font weight
fontFamily: 'Anek')), // Set font family
const SizedBox(height: 20), // Add some space between the text and the image
// Display a success image
Image.asset('assets/check_circle.png',) // Load the success image
]
)
)
)
);
}
}