mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
fix: remove alert dialog from module
This commit is contained in:
parent
6f7ec0b0e6
commit
08532d368a
3 changed files with 9 additions and 31 deletions
|
@ -5,8 +5,8 @@ import 'package:flutter_registration/flutter_registration.dart';
|
|||
|
||||
class ExampleRegistrationRepository with RegistrationRepository {
|
||||
@override
|
||||
Future<void> register(HashMap values) {
|
||||
Future<bool> register(HashMap values) {
|
||||
debugPrint('register: $values');
|
||||
return Future.value(null);
|
||||
return Future.value(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,34 +14,12 @@ class RegistrationScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
var translations = registrationOptions.registrationTranslations;
|
||||
|
||||
void showError(String error) => showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
content: Text(error),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(
|
||||
context,
|
||||
translations.closeBtn,
|
||||
),
|
||||
child: Text(
|
||||
translations.closeBtn,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
void register(values) => registrationOptions.registrationRepository
|
||||
.register(values)
|
||||
.then(
|
||||
(_) => registrationOptions.afterRegistration(),
|
||||
)
|
||||
.catchError(
|
||||
(error) {
|
||||
showError(
|
||||
error.toString(),
|
||||
);
|
||||
void register(values) =>
|
||||
registrationOptions.registrationRepository.register(values).then(
|
||||
(response) {
|
||||
if (response) {
|
||||
registrationOptions.afterRegistration();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'dart:collection';
|
||||
|
||||
mixin RegistrationRepository {
|
||||
Future<void> register(HashMap values);
|
||||
Future<bool> register(HashMap values);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue