-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from kackogut/feature/form_errors
Feature/form validation
- Loading branch information
Showing
16 changed files
with
426 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# sol_pay_gen | ||
# Solana Pay QR generator | ||
|
||
QR code generator for Solana Pay | ||
|
||
## Getting Started | ||
## Checklist | ||
|
||
This project is a starting point for a Flutter application. | ||
- ✅ Validation | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) | ||
|
||
For help getting started with Flutter development, view the | ||
[online documentation](https://docs.flutter.dev/), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
- 🚧 Download QR code | ||
- 🚧 SPL token picker | ||
- 🚧 Upload custom icon | ||
- 🚧 Adaptive layout | ||
- 🚧 How it works page | ||
- 🚧 Transaction request | ||
- 🚧 Transactions history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import '../error/input_error.dart'; | ||
|
||
class TextValue { | ||
TextValue({ | ||
this.text = "", | ||
this.error, | ||
}); | ||
|
||
final String text; | ||
final InputError? error; | ||
|
||
TextValue copyWith({ | ||
String? text, | ||
InputError? error, | ||
}) => | ||
TextValue( | ||
text: text ?? this.text, | ||
error: error ?? this.error, | ||
); | ||
|
||
bool isValid() => error == null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
abstract class InputError { | ||
abstract String text; | ||
} | ||
|
||
class NotANumber extends InputError { | ||
@override | ||
String text = "Field must be a number"; | ||
} | ||
|
||
class EmptyAmount extends InputError { | ||
@override | ||
String text = "Amount must be more than 0 if present"; | ||
} | ||
|
||
class RequiredAmount extends InputError { | ||
@override | ||
String text = "Field is required"; | ||
} | ||
|
||
class KeyNotBase58Encoded extends InputError { | ||
@override | ||
String text = "Invalid value, must be base58 encoded"; | ||
} | ||
|
||
class KeyLengthInvalid extends InputError { | ||
@override | ||
String text = "Key value must be between 32 and 44 characters"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.