You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.1 KiB
58 lines
2.1 KiB
7 months ago
|
import 'package:counters/address.dart';
|
||
|
import 'package:counters/datbase.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||
|
|
||
|
class NewAddressPage extends StatelessWidget {
|
||
|
final streetNameController = TextEditingController();
|
||
|
final commentsController = TextEditingController();
|
||
|
|
||
|
NewAddressPage({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||
|
title: Text(AppLocalizations.of(context)!.new_address_title),
|
||
|
),
|
||
|
body: Center(
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
TextField(
|
||
|
controller: streetNameController,
|
||
|
decoration: InputDecoration(
|
||
|
hintStyle: const TextStyle(color: Colors.blue),
|
||
|
hintText:
|
||
|
AppLocalizations.of(context)!.enter_your_address),
|
||
|
),
|
||
|
const SizedBox(height: 50),
|
||
|
TextField(
|
||
|
controller: commentsController,
|
||
|
decoration: InputDecoration(
|
||
|
hintStyle: const TextStyle(color: Colors.blue),
|
||
|
hintText: AppLocalizations.of(context)!
|
||
|
.enter_your_address_comments),
|
||
|
),
|
||
|
const SizedBox(height: 50),
|
||
|
TextButton(
|
||
|
onPressed: () {
|
||
|
DBProvider.db
|
||
|
.newAddress(Address(
|
||
|
streetName: streetNameController.text,
|
||
|
comments: commentsController.text))
|
||
|
.then((value) => Navigator.pop(context));
|
||
|
},
|
||
|
child: Text(
|
||
|
AppLocalizations.of(context)!.add_new_address_button))
|
||
|
]),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|