Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/frontend/nursery/logout #192

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions frontend/where_child_bus/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:where_child_bus/pages/auth_page/auth_page.dart';
import 'package:where_child_bus/pages/bus_list_page/bus_list_page.dart';
import 'package:where_child_bus/pages/camera_page/camera_bus_select_page.dart';
import 'package:where_child_bus/pages/notification_page/notification_page.dart';
Expand All @@ -21,6 +22,16 @@ class _AppState extends State<App> {
return Scaffold(
appBar: AppBar(
title: Text(['園児一覧', '送迎バスコース一覧', '連絡情報設定', 'カメラ'][_selectedIndex]),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.logout),
onPressed: () => {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const AuthPage()))
}),
],
),
body: [
const ChildListPage(),
Expand Down
4 changes: 4 additions & 0 deletions frontend/where_child_bus/lib/pages/auth_page/auth_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import 'dart:developer' as developer;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:where_child_bus/app.dart';
import 'package:where_child_bus/pages/register_page/register_page.dart';
import 'package:where_child_bus/util/api/nursery_login.dart';
import 'package:where_child_bus/models/nursery_data.dart';
import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/nursery.pb.dart';

import 'widget/register_button.dart';

enum NurseryLoginError {
unknown,
invalidCredentials,
Expand Down Expand Up @@ -48,6 +51,7 @@ class _AuthPageState extends State<AuthPage> {
_loginError == NurseryLoginError.invalidCredentials)
emailOrPasswordNotFound(),
loginButton(),
RegisterButton(context: context),
];

return Center(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:where_child_bus/pages/register_page/register_page.dart';

class RegisterButton extends StatelessWidget {
const RegisterButton({
super.key,
required this.context,
});

final BuildContext context;

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(15),
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.6,
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RegisterPage(),
),
);
},
child: const Text('新規登録はこちら'),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class _RegisterPageState extends State<RegisterPage> {
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
appBar: AppBar(
title: const Text('新規登録'),
),
resizeToAvoidBottomInset: true,
body: pageBody(),
),
Expand Down Expand Up @@ -116,7 +119,7 @@ class _RegisterPageState extends State<RegisterPage> {

Widget titleText() => const Padding(
padding: EdgeInsets.only(bottom: 32),
child: Text('WhereChildBus',
child: Text('ほいくるーず',
style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold)),
);

Expand Down
Loading