Skip to content

Commit

Permalink
Updated the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Vustron committed Nov 16, 2023
1 parent 4042cec commit 7407501
Showing 1 changed file with 106 additions and 59 deletions.
165 changes: 106 additions & 59 deletions lib/components/worldtimeContent.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// ignore_for_file: file_names, prefer_const_constructors, prefer_const_constructors_in_immutables, camel_case_types, use_key_in_widget_constructors, library_private_types_in_public_api, prefer_const_literals_to_create_immutables, unused_import, unused_local_variable, must_be_immutable
// ignore_for_file: file_names, prefer_const_constructors, prefer_const_constructors_in_immutables, camel_case_types, use_key_in_widget_constructors, library_private_types_in_public_api, prefer_const_literals_to_create_immutables, unused_import, unused_local_variable, must_be_immutable, unused_field

import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import '../controller/localAuth.dart';
import 'package:firebase_auth/firebase_auth.dart';

class WorldTimeContent extends StatefulWidget {
late Map<dynamic, dynamic>? data;
Expand All @@ -21,8 +23,24 @@ class WorldTimeContent extends StatefulWidget {
}

class _WorldTimeContentState extends State<WorldTimeContent> {
final AuthController _auth = AuthController();

@override
Widget build(BuildContext context) {
final User? user = FirebaseAuth.instance.currentUser;

// Default values if user is null
String name = 'Default Name';
String email = '[email protected]';
String photoUrl = 'assets/images/vustron.png';

if (user != null) {
// Update values if user is not null
name = user.displayName ?? name;
email = user.email ?? email;
photoUrl = user.photoURL ?? photoUrl;
}

return Scaffold(
body: SafeArea(
child: Container(
Expand All @@ -36,65 +54,94 @@ class _WorldTimeContentState extends State<WorldTimeContent> {
padding: EdgeInsets.fromLTRB(0, 140.0, 0, 0),
child: Column(
children: <Widget>[
TextButton.icon(
onPressed: () {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Center(
child: SpinKitPouringHourGlass(
color: Colors.amber,
size: 80.0,
),
);
},
);
Future.delayed(Duration(seconds: 1), () {
Navigator.pop(context); // Close the dialog
Navigator.pushNamed(context, '/profile');
});
},
icon: Icon(Icons.supervised_user_circle_rounded,
color: widget.textColor),
label: Text('Profile',
style: GoogleFonts.zenDots(
color: widget.textColor,
)),
),
TextButton.icon(
onPressed: () async {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Center(
child: SpinKitPouringHourGlass(
color: Colors.amber,
size: 80.0,
),
);
},
);
Future.delayed(Duration(seconds: 1), () async {
Navigator.pop(context); // Close the dialog
dynamic result =
await Navigator.pushNamed(context, '/changelocation');
setState(() {
widget.data = {
'time': result['time'],
'location': result['location'],
'flag': result['flag'],
'isDayTime': result['isDayTime'],
};
Center(
child: InkWell(
onTap: () {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Center(
child: SpinKitPouringHourGlass(
color: Colors.amber,
size: 80.0,
),
);
},
);
Future.delayed(Duration(seconds: 1), () {
Navigator.pop(context); // Close the dialog
Navigator.pushNamed(context, '/profile');
});
});
},
icon: Icon(Icons.location_pin, color: widget.textColor),
label: Text('Change Location',
style: GoogleFonts.zenDots(
color: widget.textColor,
)),
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
backgroundImage: user != null
? (photoUrl.startsWith('http') ||
photoUrl.startsWith('https'))
? NetworkImage(photoUrl)
: AssetImage(photoUrl)
as ImageProvider<Object>?
: AssetImage(photoUrl),
radius: 20.0,
),
SizedBox(
width: 8.0,
), // Adjust the spacing between CircleAvatar and Text
Text(
name,
style: GoogleFonts.zenDots(
color: Colors.white,
fontSize: 12.0,
fontWeight: FontWeight.bold,
),
),
],
),
SizedBox(height: 10.0),
TextButton.icon(
onPressed: () async {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Center(
child: SpinKitPouringHourGlass(
color: Colors.amber,
size: 80.0,
),
);
},
);
Future.delayed(Duration(seconds: 1), () async {
Navigator.pop(context); // Close the dialog
dynamic result = await Navigator.pushNamed(
context, '/changelocation');
setState(() {
widget.data = {
'time': result['time'],
'location': result['location'],
'flag': result['flag'],
'isDayTime': result['isDayTime'],
};
});
});
},
icon:
Icon(Icons.location_pin, color: widget.textColor),
label: Text('Change Location',
style: GoogleFonts.zenDots(
color: widget.textColor,
)),
),
],
),
),
),
SizedBox(height: 20.0),
Row(
Expand Down

0 comments on commit 7407501

Please sign in to comment.