Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Transparent error builder, added decimal input for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskokoska committed Sep 2, 2023
1 parent fbe5f68 commit 66884d8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion budget_simple/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ class App extends StatelessWidget {
return MaterialApp(
// useInheritedMediaQuery: true,
locale: DevicePreview.locale(context),
builder: DevicePreview.appBuilder,
builder: (context, child) {
if (kReleaseMode) {
ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
return Container(color: Colors.transparent);
};
}
return child ?? const SizedBox.shrink();
},
themeAnimationDuration: const Duration(milliseconds: 1000),
title: 'Allowance',
theme: ThemeData(
Expand Down
5 changes: 4 additions & 1 deletion budget_simple/lib/pages/on_board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ class OnBoardingPageBodyState extends State<OnBoardingPageBody> {
child: TextFormField(
initialValue: selectedAmount.toInt().toString(),
onChanged: (value) {
// We cannot allow users to add decimals here
// We have no way to validate the entry, if a user enters too many decimals
// for example, they can still move on to the next step without any issues.
setState(() {
selectedAmount = double.tryParse(value) ?? 0;
selectedAmount = double.tryParse(value) ?? 500;
});
},
textAlign: TextAlign.center,
Expand Down
4 changes: 3 additions & 1 deletion budget_simple/lib/widgets/increase_limit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class _IncreaseLimitState extends State<IncreaseLimit> {
} else if (getDecimalSeparator() == ".") {
value = value.replaceAll(",", "");
}
print(value);
setState(() {
selectedAmount = double.tryParse(value) ?? 0;
});
Expand All @@ -103,7 +104,8 @@ class _IncreaseLimitState extends State<IncreaseLimit> {
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp(r'[0-9,.]')),
],
keyboardType: TextInputType.number,
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
style: const TextStyle(fontSize: 20),
decoration: const InputDecoration(
contentPadding: EdgeInsets.symmetric(
Expand Down
2 changes: 1 addition & 1 deletion budget_simple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: budget_simple
description: A simple budget app.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.4.1+15
version: 1.4.2+16

environment:
sdk: '>=2.19.0-444.0.dev <3.0.0'
Expand Down

0 comments on commit 66884d8

Please sign in to comment.