Settings
This commit is contained in:
parent
f81c8f8d2c
commit
63edb15a1a
|
|
@ -1,8 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/lists/app_list_tile.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
|
@ -171,42 +171,3 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppListTile extends StatelessWidget {
|
|
||||||
const AppListTile({
|
|
||||||
this.icon,
|
|
||||||
this.title,
|
|
||||||
this.subtitle,
|
|
||||||
this.dense = false,
|
|
||||||
this.onTap,
|
|
||||||
this.copyValue,
|
|
||||||
});
|
|
||||||
|
|
||||||
final IconData icon;
|
|
||||||
final String title;
|
|
||||||
final String subtitle;
|
|
||||||
final bool dense;
|
|
||||||
final Function onTap;
|
|
||||||
final String copyValue;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Material(
|
|
||||||
color: Theme.of(context).canvasColor,
|
|
||||||
child: ListTile(
|
|
||||||
contentPadding: EdgeInsets.only(left: 12.0, top: 8.0, bottom: 8.0),
|
|
||||||
leading: Icon(icon),
|
|
||||||
title: Text(title),
|
|
||||||
subtitle: subtitle == null ? Container() : Text(subtitle),
|
|
||||||
dense: dense,
|
|
||||||
onTap: onTap,
|
|
||||||
onLongPress: () {
|
|
||||||
Clipboard.setData(ClipboardData(text: copyValue ?? title));
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text(AppLocalization.of(context)
|
|
||||||
.copiedToClipboard
|
|
||||||
.replaceFirst(':value', copyValue ?? title))));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/buttons/edit_icon_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/buttons/edit_icon_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/lists/app_list_tile.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/user/view/user_view_vm.dart';
|
import 'package:invoiceninja_flutter/ui/user/view/user_view_vm.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/two_value_header.dart';
|
|
||||||
import 'package:invoiceninja_flutter/utils/icons.dart';
|
import 'package:invoiceninja_flutter/utils/icons.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class UserView extends StatelessWidget {
|
class UserView extends StatelessWidget {
|
||||||
const UserView({
|
const UserView({
|
||||||
|
|
@ -32,17 +33,17 @@ class UserView extends StatelessWidget {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: !isMobile(context)
|
leading: !isMobile(context)
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: Icon(Icons.arrow_back),
|
icon: Icon(Icons.arrow_back),
|
||||||
onPressed: viewModel.onBackPressed,
|
onPressed: viewModel.onBackPressed,
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
title: EntityStateTitle(entity: user),
|
title: EntityStateTitle(entity: user),
|
||||||
actions: [
|
actions: [
|
||||||
userCompany.canEditEntity(user)
|
userCompany.canEditEntity(user)
|
||||||
? EditIconButton(
|
? EditIconButton(
|
||||||
isVisible: !(user.isDeleted ?? false), // TODO remove this
|
isVisible: !(user.isDeleted ?? false), // TODO remove this
|
||||||
onPressed: () => viewModel.onEditPressed(context),
|
onPressed: () => viewModel.onEditPressed(context),
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
ActionMenuButton(
|
ActionMenuButton(
|
||||||
entityActions: user.getActions(userCompany: userCompany),
|
entityActions: user.getActions(userCompany: userCompany),
|
||||||
|
|
@ -54,12 +55,21 @@ class UserView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
AppListTile(
|
||||||
|
icon: Icons.email,
|
||||||
|
title: user.email,
|
||||||
|
copyValue: user.email,
|
||||||
|
subtitle: localization.email,
|
||||||
|
onTap: () => launch('mailto:' + user.email),
|
||||||
|
),
|
||||||
|
/*
|
||||||
TwoValueHeader(
|
TwoValueHeader(
|
||||||
label1: localization.paidToDate,
|
label1: localization.paidToDate,
|
||||||
value1: '',
|
value1: '',
|
||||||
label2: localization.balanceDue,
|
label2: localization.balanceDue,
|
||||||
value2: '',
|
value2: '',
|
||||||
),
|
),
|
||||||
|
*/
|
||||||
Divider(
|
Divider(
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
),
|
),
|
||||||
|
|
@ -165,11 +175,11 @@ class UserView extends StatelessWidget {
|
||||||
class EntityListTile extends StatelessWidget {
|
class EntityListTile extends StatelessWidget {
|
||||||
const EntityListTile(
|
const EntityListTile(
|
||||||
{this.icon,
|
{this.icon,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.onLongPress,
|
this.onLongPress,
|
||||||
this.title,
|
this.title,
|
||||||
this.subtitle,
|
this.subtitle,
|
||||||
this.bottomPadding = 12});
|
this.bottomPadding = 12});
|
||||||
|
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
final Function onLongPress;
|
final Function onLongPress;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/lists/app_list_tile.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
|
@ -154,43 +154,3 @@ class _VendorViewDetailsState extends State<VendorViewDetails> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppListTile extends StatelessWidget {
|
|
||||||
const AppListTile({
|
|
||||||
this.icon,
|
|
||||||
this.title,
|
|
||||||
this.subtitle,
|
|
||||||
this.dense = false,
|
|
||||||
this.onTap,
|
|
||||||
this.copyValue,
|
|
||||||
});
|
|
||||||
|
|
||||||
final IconData icon;
|
|
||||||
final String title;
|
|
||||||
final String subtitle;
|
|
||||||
final bool dense;
|
|
||||||
final Function onTap;
|
|
||||||
final String copyValue;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Material(
|
|
||||||
color: Theme.of(context).canvasColor,
|
|
||||||
child: ListTile(
|
|
||||||
contentPadding: EdgeInsets.only(left: 12.0, top: 8.0, bottom: 8.0),
|
|
||||||
leading: Icon(icon),
|
|
||||||
title: Text(title),
|
|
||||||
subtitle: subtitle == null ? Container() : Text(subtitle),
|
|
||||||
dense: dense,
|
|
||||||
onTap: onTap,
|
|
||||||
onLongPress: () {
|
|
||||||
Clipboard.setData(ClipboardData(text: copyValue ?? title));
|
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
|
||||||
content: Text(AppLocalization.of(context)
|
|
||||||
.copiedToClipboard
|
|
||||||
.replaceFirst(':value', copyValue ?? title))));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue