Settings
This commit is contained in:
parent
6a48f5a647
commit
f462ebb9ed
|
|
@ -115,7 +115,8 @@ var memoizedGatewayList = memo1(
|
||||||
List<String> gatewayList(BuiltMap<String, GatewayEntity> gatewayMap) {
|
List<String> gatewayList(BuiltMap<String, GatewayEntity> gatewayMap) {
|
||||||
final list = gatewayMap.keys.toList();
|
final list = gatewayMap.keys.toList();
|
||||||
|
|
||||||
list.sort((idA, idB) => gatewayMap[idA].id.compareTo(gatewayMap[idB].id));
|
list.sort((idA, idB) =>
|
||||||
|
gatewayMap[idA].sortOrder.compareTo(gatewayMap[idB].sortOrder));
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/company_gateway/edit/company_gateway_edit_vm.dart';
|
import 'package:invoiceninja_flutter/ui/company_gateway/edit/company_gateway_edit_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/settings/settings_scaffold.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||||
|
|
||||||
class CompanyGatewayEdit extends StatefulWidget {
|
class CompanyGatewayEdit extends StatefulWidget {
|
||||||
const CompanyGatewayEdit({
|
const CompanyGatewayEdit({
|
||||||
|
|
@ -260,6 +261,10 @@ class GatewayConfigSettings extends StatelessWidget {
|
||||||
final state = viewModel.state;
|
final state = viewModel.state;
|
||||||
final gateway = state.staticState.gatewayMap[companyGateway.gatewayId];
|
final gateway = state.staticState.gatewayMap[companyGateway.gatewayId];
|
||||||
|
|
||||||
|
if (gateway == null) {
|
||||||
|
return SizedBox();
|
||||||
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: gateway.parsedFields.keys
|
children: gateway.parsedFields.keys
|
||||||
.map((field) => GatewayConfigField(
|
.map((field) => GatewayConfigField(
|
||||||
|
|
@ -324,7 +329,7 @@ class _GatewayConfigFieldState extends State<GatewayConfigField> {
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: widget.field,
|
labelText: toTitleCase(widget.field),
|
||||||
),
|
),
|
||||||
onChanged: (value) => _onChanged(),
|
onChanged: (value) => _onChanged(),
|
||||||
obscureText: _obscureText(widget.field),
|
obscureText: _obscureText(widget.field),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,31 @@ String toSnakeCase(String value) {
|
||||||
RegExp(r'[A-Z]'), (Match match) => '_' + match[0].toLowerCase());
|
RegExp(r'[A-Z]'), (Match match) => '_' + match[0].toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String toSpaceCase(String value) {
|
||||||
|
return value.replaceAllMapped(
|
||||||
|
RegExp(r'[A-Z]'), (Match match) => ' ' + match[0].toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
String toTitleCase(String text) {
|
||||||
|
if (text.length <= 1) {
|
||||||
|
return text.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
text = toSpaceCase(text);
|
||||||
|
final words = text.split(' ');
|
||||||
|
final capitalized = words.map((word) {
|
||||||
|
if (word == 'url') {
|
||||||
|
return 'URL';
|
||||||
|
}
|
||||||
|
|
||||||
|
final first = word.substring(0, 1).toUpperCase();
|
||||||
|
final rest = word.substring(1);
|
||||||
|
return '$first$rest';
|
||||||
|
});
|
||||||
|
|
||||||
|
return capitalized.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
String getFirstName(String value) {
|
String getFirstName(String value) {
|
||||||
final parts = value.split(' ');
|
final parts = value.split(' ');
|
||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue