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/account page #115

Merged
merged 12 commits into from
Aug 9, 2023
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
1 change: 1 addition & 0 deletions packages/dart_flutter_common/lib/src/widgets/_export.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'generic_image.dart';
export 'material_horizontal_card.dart';
export 'section.dart';
export 'selectable_chips.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import 'package:flutter/material.dart';

import '../../dart_flutter_common.dart';

/// タイトル、詳細、画像の3つを表示するカードウィジェット
class MaterialHorizontalCard extends StatelessWidget {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実機で見ました、めちゃいい感じですね!!

/// タイトル、詳細、画像の3つを表示するカードウィジェット
const MaterialHorizontalCard({
required this.title,
required this.description,
required this.imageUrl,
super.key,
});

/// 表示する画像の URL 文字列。
final String imageUrl;

/// カードに表示するタイトル。
final String title;

/// カードに表示する詳細
final String description;

@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
),
Text(
description,
style: Theme.of(context).textTheme.labelSmall,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(12),
bottomRight: Radius.circular(12),
),
child: GenericImage.square(
imageUrl: imageUrl,
),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ class JobRepository {
/// 指定した [Job] を取得する。
Future<ReadJob?> fetchJob({required String jobId}) =>
_query.fetchDocument(jobId: jobId);

/// 指定したユーザーの [Job] を全件取得する。
Future<List<ReadJob>> fetchUserJobs({required String userId}) =>
_query.fetchDocuments(
queryBuilder: (query) => query.where('hostId', isEqualTo: userId),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import '../../../auth/ui/auth_dependent_builder.dart';
import '../../../chat/read_status.dart';
import '../../../chat/ui/chat_room.dart';
import '../../../chat/ui/chat_rooms.dart';
import '../../../host/ui/create_or_update_host.dart';
import '../../../host/ui/host.dart';
import '../../../job/ui/job_detail.dart';
import '../../../map/ui/map.dart';
import '../../../package_info.dart';
import '../../../push_notification/firebase_messaging.dart';
import '../../../scaffold_messenger_controller.dart';
import '../../../user/user.dart';
import '../../../user/user_mode.dart';
import '../../../worker/ui/worker.dart';
import '../../color/ui/color.dart';
import '../../firebase_storage/ui/firebase_storage.dart';
import '../../force_update/ui/force_update.dart';
Expand Down Expand Up @@ -116,32 +119,35 @@ class _DevelopmentItemsPageState extends ConsumerState<DevelopmentItemsPage> {
),
),
),
const ListTile(
title: Text('ワーカーページ'),
// onTap: () => context.router.pushNamed(
// WorkerPage.location('WORKER_ID_HERE'),
// ),
ListTile(
title: const Text('ワーカーページ'),
onTap: () => context.router.pushNamed(
WorkerPage.location(userId: 'b1M4bcp7zEVpgHXYhOVWt8BMkq23'),
),
),
const ListTile(
title: Text('ワーカー情報編集ページ'),
// onTap: () => context.router.pushNamed(
// UpdateWorkerPage.location('WORKER_ID_HERE'),
// ),
),
const ListTile(
title: Text('ホストページ'),
// onTap: () => context.router.pushNamed(
// HOSTPage.location('HOST_ID_HERE'),
// ),
ListTile(
title: const Text('ホストページ'),
onTap: () => context.router.pushNamed(
HostPage.location(userId: 'b1M4bcp7zEVpgHXYhOVWt8BMkq23'),
),
),
const ListTile(
title: Text(
ListTile(
title: const Text(
'ホストとして登録ページ (StateNotifier?, geoflutterfire_plus, '
'flutter_google_maps, geolocator)',
),
// onTap: () => context.router.pushNamed(
// CreateOrUpdateHostPage.location('HOST_ID_HERE'),
// ),
onTap: () => context.router.pushNamed(
CreateOrUpdateHostPage.location(
userId: 'b1M4bcp7zEVpgHXYhOVWt8BMkq23',
actionType: ActionType.create.name,
),
),
),
const Divider(),
Padding(
Expand Down
53 changes: 53 additions & 0 deletions packages/mottai_flutter_app/lib/host/ui/create_or_update_host.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

/// ホスト情報を作成するか更新するかのタイプ
enum ActionType {
/// ホスト情報を新規に作成する
create,

/// ホスト情報を更新する
update
}

/// ホストページ。
@RoutePage()
class CreateOrUpdateHostPage extends ConsumerWidget {
const CreateOrUpdateHostPage({
@PathParam('userId') required this.userId,
@PathParam('actionType') required this.actionType,
super.key,
});

/// [AutoRoute] で指定するパス文字列。
static const path = '/host/:userId/:actionType';

/// [CreateOrUpdateHostPage] に遷移する際に `context.router.pushNamed` で指定する文字列。
static String location({
required String userId,
required String actionType,
}) =>
'/host/$userId/$actionType';

/// パスパラメータから得られるユーザーの ID.
final String userId;

/// パスパラメータから得られるホスト情報を【作成】するか【更新】するかの タイプ.
final String actionType;

@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: AppBar(
title: const Text('ホスト情報を入力'),
),
body: Column(
children: [
const Text('ホスト情報の作成または更新ページ'),
Text('このページは【$actionType】タイプで表示されています')
],
),
);
}
}
Loading
Loading