// ignore_for_file: prefer_const_literals_to_create_immutables import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:flutter_application_1/Project/main.dart'; import 'package:flutter_application_1/Project/Admin/Borrowed.dart'; import 'package:flutter_application_1/Project/Admin/Itemlist.dart'; import 'package:flutter_application_1/Project/Admin/Returned.dart'; import '../utils/colors.dart'; const Color bColor = Color.fromRGBO(146, 202, 234, 1); const Color aColor = Color.fromARGB(234, 146, 234, 171); const Color cColor = Color.fromARGB(255, 146, 171, 234); class HomeAdmin extends StatelessWidget { const HomeAdmin({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: Container( constraints: const BoxConstraints.expand(), decoration: const BoxDecoration( image: DecorationImage( image: NetworkImage( "https://i.pinimg.com/originals/77/7b/07/777b07a784b619eb9840734261133cbd.jpg"), fit: BoxFit.cover), ), child: Padding( padding: const EdgeInsets.all(32.0), child: Column( children: [ const SizedBox( height: 31, ), Row( children: [ const Spacer(), Text( 'Welcome Admin', style: Theme.of(context).textTheme.headlineMedium!.copyWith( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 30), ), const Spacer(), ], ), const SizedBox( height: 50, ), Row( children: [ const Spacer(), InkWell( child: Container( height: 71, width: 296, decoration: BoxDecoration( color: aColor, border: Border.all( width: 1, color: aColor, ), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ const SizedBox( width: 20, ), const Icon( Icons.receipt_long_outlined, size: 50, ), const Spacer(), const Text( 'Borrowed list', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900), ), const Spacer(), ], )), onTap: () { Navigator.push( context, MaterialPageRoute( builder: ((context) => BorrowAdmin()), )); }, ), const Spacer(), ], ), const SizedBox( height: 20, ), Row( children: [ const Spacer(), InkWell( child: Container( height: 71, width: 296, decoration: BoxDecoration( color: bColor, border: Border.all( width: 1, color: bColor, ), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ const SizedBox( width: 20, ), const Icon( Icons.receipt_long_outlined, size: 50, ), const Spacer(), const Text( 'Returned list', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900), ), const Spacer(), ], )), onTap: () { Navigator.push( context, MaterialPageRoute( builder: ((context) => const ReProject()), )); }, ), const Spacer(), ], ), const SizedBox( height: 20, ), Row( children: [ const Spacer(), InkWell( child: Container( height: 71, width: 296, decoration: BoxDecoration( color: cColor, border: Border.all( width: 1, color: cColor, ), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ const SizedBox( width: 20, ), const Icon( Icons.receipt_long_outlined, size: 50, ), const Spacer(), const Text( 'List of items', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900), ), const Spacer(), ], )), onTap: () { Navigator.push( context, MaterialPageRoute( builder: ((context) => ItemAlist()), )); }, ), const Spacer(), ], ), const SizedBox( height: 20, ), Row( children: [ const Spacer(), InkWell( child: Container( height: 71, width: 296, decoration: BoxDecoration( color: kOrangeColor, border: Border.all( width: 1, color: cColor, ), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ const SizedBox( width: 20, ), const Icon( Icons.logout, color: Colors.red, size: 50, ), const Spacer(), const Text( 'Log out', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900, color: Colors.red), ), const Spacer(), ], ), ), onTap: () async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text( 'Logout', style: Theme.of(context) .textTheme .headlineSmall! .copyWith(fontWeight: FontWeight.bold), ), content: const Text('Are you sure you want to logout?'), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); }, child: const Text( 'Cancel', style: TextStyle(color: Colors.blue), ), ), TextButton( onPressed: () async { await FirebaseAuth.instance.signOut(); // ignore: use_build_context_synchronously Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (context) => const Splash()), (Route route) => false, ); }, child: const Text( 'Logout', style: TextStyle( color: Colors.red, ), ), ), ], ); }, ); }, ), const Spacer(), ], ), ], ), ), ), ); } }