mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Merged with dev
This commit is contained in:
@ -42,4 +42,4 @@ abstract class ColorsManager {
|
||||
static const Color textGreen = Color(0xFF008905);
|
||||
static const Color yaGreen = Color(0xFFFFBF44);
|
||||
}
|
||||
//0036E6
|
||||
//background: #999999;
|
||||
|
@ -60,23 +60,29 @@ class Assets {
|
||||
static const String nobodyTime = "assets/icons/nobody_time.svg";
|
||||
|
||||
// Automation functions
|
||||
static const String tempPasswordUnlock = "assets/icons/automation_functions/temp_password_unlock.svg";
|
||||
static const String doorlockNormalOpen = "assets/icons/automation_functions/doorlock_normal_open.svg";
|
||||
static const String tempPasswordUnlock =
|
||||
"assets/icons/automation_functions/temp_password_unlock.svg";
|
||||
static const String doorlockNormalOpen =
|
||||
"assets/icons/automation_functions/doorlock_normal_open.svg";
|
||||
static const String doorbell = "assets/icons/automation_functions/doorbell.svg";
|
||||
static const String remoteUnlockViaApp = "assets/icons/automation_functions/remote_unlock_via_app.svg";
|
||||
static const String remoteUnlockViaApp =
|
||||
"assets/icons/automation_functions/remote_unlock_via_app.svg";
|
||||
static const String doubleLock = "assets/icons/automation_functions/double_lock.svg";
|
||||
static const String selfTestResult = "assets/icons/automation_functions/self_test_result.svg";
|
||||
static const String lockAlarm = "assets/icons/automation_functions/lock_alarm.svg";
|
||||
static const String presenceState = "assets/icons/automation_functions/presence_state.svg";
|
||||
static const String currentTemp = "assets/icons/automation_functions/current_temp.svg";
|
||||
static const String presence = "assets/icons/automation_functions/presence.svg";
|
||||
static const String residualElectricity = "assets/icons/automation_functions/residual_electricity.svg";
|
||||
static const String residualElectricity =
|
||||
"assets/icons/automation_functions/residual_electricity.svg";
|
||||
static const String hijackAlarm = "assets/icons/automation_functions/hijack_alarm.svg";
|
||||
static const String passwordUnlock = "assets/icons/automation_functions/password_unlock.svg";
|
||||
static const String remoteUnlockRequest = "assets/icons/automation_functions/remote_unlock_req.svg";
|
||||
static const String remoteUnlockRequest =
|
||||
"assets/icons/automation_functions/remote_unlock_req.svg";
|
||||
static const String cardUnlock = "assets/icons/automation_functions/card_unlock.svg";
|
||||
static const String motion = "assets/icons/automation_functions/motion.svg";
|
||||
static const String fingerprintUnlock = "assets/icons/automation_functions/fingerprint_unlock.svg";
|
||||
static const String fingerprintUnlock =
|
||||
"assets/icons/automation_functions/fingerprint_unlock.svg";
|
||||
|
||||
// Presence Sensor Assets
|
||||
static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg";
|
||||
@ -169,12 +175,21 @@ class Assets {
|
||||
//assets/icons/2gang.svg
|
||||
static const String twoGang = 'assets/icons/2gang.svg';
|
||||
|
||||
|
||||
|
||||
static const String frequencyIcon = "assets/icons/frequency_icon.svg";
|
||||
static const String voltMeterIcon = "assets/icons/volt_meter_icon.svg";
|
||||
static const String powerActiveIcon = "assets/icons/power_active_icon.svg";
|
||||
static const String searchIcon = "assets/icons/search_icon.svg";
|
||||
static const String voltageIcon = "assets/icons/voltage_icon.svg";
|
||||
static const String speedoMeter = "assets/icons/speedo_meter.svg";
|
||||
//assets/icons/account_setting.svg
|
||||
static const String accountSetting = 'assets/icons/account_setting.svg';
|
||||
|
||||
//assets/icons/settings.svg
|
||||
static const String settings = 'assets/icons/settings.svg';
|
||||
|
||||
//assets/icons/sign_out.svg
|
||||
static const String signOut = 'assets/icons/sign_out.svg';
|
||||
|
||||
//assets/icons/logo_grey.svg
|
||||
static const String logoGrey = 'assets/icons/logo-grey.svg';
|
||||
}
|
||||
|
@ -33,12 +33,11 @@ InputDecoration? textBoxDecoration({bool suffixIcon = false}) =>
|
||||
BoxDecoration containerDecoration = BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3), // changes position of shadow
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 5), // changes position of shadow
|
||||
),
|
||||
],
|
||||
color: ColorsManager.boxColor,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
||||
|
||||
|
@ -3,6 +3,7 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
final myTheme = ThemeData(
|
||||
fontFamily: 'Aftika',
|
||||
useMaterial3: true,
|
||||
textTheme: const TextTheme(
|
||||
bodySmall: TextStyle(
|
||||
fontSize: 13,
|
||||
|
239
lib/utils/user_drop_down_menu.dart
Normal file
239
lib/utils/user_drop_down_menu.dart
Normal file
@ -0,0 +1,239 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
|
||||
class UserDropdownMenu extends StatefulWidget {
|
||||
const UserDropdownMenu({super.key, required this.user});
|
||||
final UserModel? user;
|
||||
|
||||
@override
|
||||
_UserDropdownMenuState createState() => _UserDropdownMenuState();
|
||||
}
|
||||
|
||||
class _UserDropdownMenuState extends State<UserDropdownMenu> {
|
||||
bool _isDropdownOpen = false;
|
||||
|
||||
void _toggleDropdown() {
|
||||
setState(() {
|
||||
_isDropdownOpen = !_isDropdownOpen;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
_toggleDropdown();
|
||||
await _showPopupMenu(context);
|
||||
setState(() {
|
||||
_isDropdownOpen = false;
|
||||
});
|
||||
},
|
||||
child: Transform.rotate(
|
||||
angle: _isDropdownOpen ? -1.5708 : 1.5708,
|
||||
child: const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showPopupMenu(BuildContext context) async {
|
||||
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
|
||||
final RelativeRect position = RelativeRect.fromRect(
|
||||
Rect.fromLTRB(
|
||||
overlay.size.width,
|
||||
75,
|
||||
0,
|
||||
overlay.size.height,
|
||||
),
|
||||
Offset.zero & overlay.size,
|
||||
);
|
||||
|
||||
await showMenu(
|
||||
context: context,
|
||||
position: position,
|
||||
color: ColorsManager.whiteColors,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomRight: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10),
|
||||
),
|
||||
),
|
||||
items: <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset(Assets.accountSetting),
|
||||
title: Text(
|
||||
"Account Settings",
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset(Assets.settings),
|
||||
title: Text(
|
||||
"Settings",
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
return AlertDialog(
|
||||
alignment: Alignment.center,
|
||||
content: SizedBox(
|
||||
height: 200,
|
||||
width: 400,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 24, left: 24, right: 24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
Assets.blackLogo,
|
||||
height: 40,
|
||||
width: 200,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Text(
|
||||
'Log out of your Syncrow account',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox.square(
|
||||
dimension: 80,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
child: SizedBox.square(
|
||||
dimension: 78,
|
||||
child: SvgPicture.asset(
|
||||
Assets.logoGrey,
|
||||
fit: BoxFit.fitHeight,
|
||||
height: 80,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${widget.user?.firstName ?? ''} ${widget.user?.lastName}',
|
||||
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
' ${widget.user?.email}',
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actionsAlignment: MainAxisAlignment.center,
|
||||
actions: [
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
},
|
||||
child: DefaultButton(
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
elevation: 1,
|
||||
child: Text(
|
||||
'Cancel',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
AuthBloc.logout();
|
||||
context.go(RoutesConst.auth);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 200,
|
||||
child: DefaultButton(
|
||||
elevation: 1,
|
||||
child: Text(
|
||||
'Logout',
|
||||
style:
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 12, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
]);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset(Assets.signOut),
|
||||
title: Text(
|
||||
"Log Out",
|
||||
style: context.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).then((value) {
|
||||
setState(() {
|
||||
_isDropdownOpen = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user