Skip to content

Commit

Permalink
Changed type for numeric keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Zverik committed May 3, 2022
1 parent 7c9a4f1 commit 37a6c5c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/models/field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ PresetField fieldFromJson(Map<String, dynamic> data,
label: label,
placeholder: placeholder,
prerequisite: prerequisite,
keyboardType: TextInputType.number,
keyboardType: TextInputType.numberWithOptions(signed: true),
);
case 'tel':
return TextPresetField(
Expand Down
4 changes: 3 additions & 1 deletion lib/providers/osm_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
import 'package:xml/xml.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:logging/logging.dart';

final authProvider = StateNotifierProvider<OsmAuthController, String?>(
(_) => OsmAuthController());
Expand Down Expand Up @@ -60,6 +61,7 @@ class OsmAuthController extends StateNotifier<String?> {
static const kLoginKey = 'osmLogin';
static const kPasswordKey = 'osmPassword';

static final _logger = Logger('OsmAuthController');
final OpenStreetMapOAuthHelper _helper = OpenStreetMapOAuthHelper();
bool isOAuth = false;
bool? _supportsOAuth;
Expand Down Expand Up @@ -110,7 +112,7 @@ class OsmAuthController extends StateNotifier<String?> {
result = sdk >= 18;
} else if (Platform.isIOS) {
final info = await deviceInfo.iosInfo;
final match = RegExp(r'^(\d+)$').matchAsPrefix(info.systemVersion ?? '');
final match = RegExp(r'^(\d+)').matchAsPrefix(info.systemVersion ?? '');
if (match != null) {
result = int.parse(match.group(1)!) >= 11;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/editor/entrance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class _EntranceEditorPaneState extends ConsumerState<EntranceEditorPane> {
child: TextFormField(
keyboardType: editorSettings.fixNumKeyboard
? TextInputType.visiblePassword
: TextInputType.number,
: TextInputType.numberWithOptions(signed: true),
autofocus: !manualRef && entrance['addr:flats'] == null,
initialValue: entrance['addr:flats'],
style: kFieldTextStyle,
Expand Down Expand Up @@ -196,7 +196,7 @@ class _EntranceEditorPaneState extends ConsumerState<EntranceEditorPane> {
TextFormField(
keyboardType: editorSettings.fixNumKeyboard
? TextInputType.visiblePassword
: TextInputType.number,
: TextInputType.numberWithOptions(signed: true),
style: kFieldTextStyle,
focusNode: _focus,
initialValue: entrance['ref'],
Expand Down
12 changes: 6 additions & 6 deletions lib/screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,22 @@ class SettingsPage extends ConsumerWidget {
title: Text(loc.settingsEditor),
tiles: [
SettingsTile.switchTile(
title: Text(loc.settingsPreferContact),
title: Text(loc.settingsNumericKeyboard),
onToggle: (value) {
ref
.read(editorSettingsProvider.notifier)
.setPreferContact(value);
.setFixNumKeyboard(value);
},
initialValue: editorSettings.preferContact,
initialValue: editorSettings.fixNumKeyboard,
),
SettingsTile.switchTile(
title: Text(loc.settingsNumericKeyboard),
title: Text(loc.settingsPreferContact),
onToggle: (value) {
ref
.read(editorSettingsProvider.notifier)
.setFixNumKeyboard(value);
.setPreferContact(value);
},
initialValue: editorSettings.fixNumKeyboard,
initialValue: editorSettings.preferContact,
),
SettingsTile(
title: Text(loc.settingsDefaultPayment),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/address_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _AddressFormState extends ConsumerState<AddressForm> {
controller: _houseController,
keyboardType: editorSettings.fixNumKeyboard
? TextInputType.visiblePassword
: TextInputType.number,
: TextInputType.numberWithOptions(signed: true),
autofocus: widget.autoFocus,
style: kFieldTextStyle,
decoration: const InputDecoration(hintText: '1, 89, 154A, ...'),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ flutter:

flutter_icons:
android: "ic_launcher"
ios: false
ios: true
image_path: "icon/app_icon.png"

0 comments on commit 37a6c5c

Please sign in to comment.