2021-01-06 17:35:57 +00:00
|
|
|
part of 'users.dart';
|
|
|
|
|
|
|
|
class _UserDetails extends StatelessWidget {
|
|
|
|
const _UserDetails({
|
2021-03-15 15:39:44 +00:00
|
|
|
Key? key,
|
2021-01-06 17:35:57 +00:00
|
|
|
this.user,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
2021-03-15 15:39:44 +00:00
|
|
|
final User? user;
|
2021-01-06 17:35:57 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-03-18 00:55:38 +00:00
|
|
|
var config = context.watch<AppConfigCubit>().state;
|
|
|
|
|
|
|
|
var domainName = config.isDomainFilled
|
|
|
|
? config.cloudFlareDomain!.domainName!
|
|
|
|
: 'example.com';
|
|
|
|
|
2021-01-06 17:35:57 +00:00
|
|
|
return BrandModalSheet(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: 200,
|
|
|
|
decoration: BoxDecoration(
|
2021-03-15 15:39:44 +00:00
|
|
|
color: user!.color,
|
2021-01-06 17:35:57 +00:00
|
|
|
borderRadius: BorderRadius.vertical(
|
|
|
|
top: Radius.circular(20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 4,
|
|
|
|
horizontal: 2,
|
|
|
|
),
|
|
|
|
child: PopupMenuButton<PopupMenuItemType>(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
),
|
|
|
|
onSelected: (PopupMenuItemType result) {
|
|
|
|
switch (result) {
|
|
|
|
case PopupMenuItemType.reset:
|
|
|
|
break;
|
|
|
|
case PopupMenuItemType.delete:
|
|
|
|
showDialog(
|
2021-03-14 18:44:35 +00:00
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return AlertDialog(
|
2021-03-18 00:55:38 +00:00
|
|
|
title: Text('basis.confirmation'.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
content: SingleChildScrollView(
|
|
|
|
child: ListBody(
|
|
|
|
children: <Widget>[
|
2021-03-18 00:55:38 +00:00
|
|
|
Text('users.delete_confirm_question'
|
|
|
|
.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
actions: <Widget>[
|
|
|
|
TextButton(
|
2021-03-18 00:55:38 +00:00
|
|
|
child: Text('basis.cancel'.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context)..pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
TextButton(
|
|
|
|
child: Text(
|
2021-03-18 00:55:38 +00:00
|
|
|
'basis.delete'.tr(),
|
2021-01-06 17:35:57 +00:00
|
|
|
style: TextStyle(
|
|
|
|
color: BrandColors.red1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
2021-01-14 18:45:10 +00:00
|
|
|
context.read<UsersCubit>().remove(user);
|
2021-01-06 17:35:57 +00:00
|
|
|
Navigator.of(context)..pop()..pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
2021-03-14 18:44:35 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
2021-01-06 17:35:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
icon: Icon(Icons.more_vert),
|
|
|
|
itemBuilder: (BuildContext context) => [
|
|
|
|
PopupMenuItem<PopupMenuItemType>(
|
|
|
|
value: PopupMenuItemType.reset,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(left: 5),
|
2021-03-18 00:55:38 +00:00
|
|
|
child: Text('users.reset_password'.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
PopupMenuItem<PopupMenuItemType>(
|
|
|
|
value: PopupMenuItemType.delete,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(left: 5),
|
|
|
|
child: Text(
|
2021-03-18 00:55:38 +00:00
|
|
|
'basis.delete'.tr(),
|
2021-01-06 17:35:57 +00:00
|
|
|
style: TextStyle(color: BrandColors.red1),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 20,
|
|
|
|
horizontal: 15,
|
|
|
|
),
|
|
|
|
child: BrandText.h1(
|
2021-03-15 15:39:44 +00:00
|
|
|
user!.login,
|
2021-01-06 17:35:57 +00:00
|
|
|
softWrap: true,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
Padding(
|
|
|
|
padding: brandPagePadding2.copyWith(bottom: 20),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
2021-03-18 00:55:38 +00:00
|
|
|
BrandText.small('users.account'.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
Container(
|
|
|
|
height: 40,
|
|
|
|
alignment: Alignment.centerLeft,
|
2021-03-18 00:55:38 +00:00
|
|
|
child: BrandText.h4('${user!.login}@$domainName'),
|
2021-01-06 17:35:57 +00:00
|
|
|
),
|
|
|
|
SizedBox(height: 14),
|
2021-03-18 00:55:38 +00:00
|
|
|
BrandText.small('basis.password'.tr()),
|
2021-01-06 17:35:57 +00:00
|
|
|
Container(
|
|
|
|
height: 40,
|
|
|
|
alignment: Alignment.centerLeft,
|
2021-03-15 15:39:44 +00:00
|
|
|
child: BrandText.h4(user!.password),
|
2021-01-06 17:35:57 +00:00
|
|
|
),
|
|
|
|
SizedBox(height: 24),
|
|
|
|
BrandDivider(),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
BrandButton.iconText(
|
2021-03-18 00:55:38 +00:00
|
|
|
title: 'users.send_regisration_data'.tr(),
|
2021-01-06 17:35:57 +00:00
|
|
|
icon: Icon(BrandIcons.share),
|
|
|
|
onPressed: () {},
|
|
|
|
),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum PopupMenuItemType {
|
|
|
|
reset,
|
|
|
|
delete,
|
|
|
|
}
|