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

Revert "Add pill sheet count sheet to initial setting" #545

Merged
merged 1 commit into from
Mar 22, 2022
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
3 changes: 0 additions & 3 deletions images/notch.svg

This file was deleted.

37 changes: 26 additions & 11 deletions lib/domain/initial_setting/initial_setting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ class InitialSettingStateStore extends StateNotifier<InitialSettingState> {
}

void selectedPillCategoryType(
InitialSettingPillCategoryType pillCategoryType, int? sheetCount) {
InitialSettingPillCategoryType pillCategoryType) {
state = state.copyWith(pillType: pillCategoryType);
state = state.copyWith(todayPillNumber: null);

switch (pillCategoryType) {
case InitialSettingPillCategoryType.pill_category_type_yaz_flex:
state = state.copyWith(
pillSheetTypes:
List.generate(sheetCount!, (_) => PillSheetType.pillsheet_28_0),
pillSheetTypes: [
PillSheetType.pillsheet_28_0,
PillSheetType.pillsheet_28_0,
PillSheetType.pillsheet_28_0,
],
pillSheetAppearanceMode: PillSheetAppearanceMode.sequential,
);
break;
Expand All @@ -107,29 +110,41 @@ class InitialSettingStateStore extends StateNotifier<InitialSettingState> {
break;
case InitialSettingPillCategoryType.pill_category_type_21_rest_7:
state = state.copyWith(
pillSheetTypes:
List.generate(sheetCount!, (_) => PillSheetType.pillsheet_21),
pillSheetTypes: [
PillSheetType.pillsheet_21,
PillSheetType.pillsheet_21,
PillSheetType.pillsheet_21,
],
pillSheetAppearanceMode: PillSheetAppearanceMode.number,
);
break;
case InitialSettingPillCategoryType.pill_category_type_24_fake_4:
state = state.copyWith(
pillSheetTypes:
List.generate(sheetCount!, (_) => PillSheetType.pillsheet_28_4),
pillSheetTypes: [
PillSheetType.pillsheet_28_4,
PillSheetType.pillsheet_28_4,
PillSheetType.pillsheet_28_4,
],
pillSheetAppearanceMode: PillSheetAppearanceMode.number,
);
break;
case InitialSettingPillCategoryType.pill_category_type_24_rest_4:
state = state.copyWith(
pillSheetTypes: List.generate(
sheetCount!, (_) => PillSheetType.pillsheet_24_rest_4),
pillSheetTypes: [
PillSheetType.pillsheet_24_rest_4,
PillSheetType.pillsheet_24_rest_4,
PillSheetType.pillsheet_24_rest_4,
],
pillSheetAppearanceMode: PillSheetAppearanceMode.number,
);
break;
case InitialSettingPillCategoryType.pill_category_type_21_fake_7:
state = state.copyWith(
pillSheetTypes:
List.generate(sheetCount!, (_) => PillSheetType.pillsheet_28_7),
pillSheetTypes: [
PillSheetType.pillsheet_28_7,
PillSheetType.pillsheet_28_7,
PillSheetType.pillsheet_28_7,
],
pillSheetAppearanceMode: PillSheetAppearanceMode.number,
);
break;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import 'package:pilll/analytics.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/page/hud.dart';
import 'package:pilll/components/template/setting_pill_sheet_group/setting_pill_sheet_group.dart';
import 'package:pilll/domain/initial_setting/initial_setting_state.dart';
import 'package:pilll/domain/initial_setting/today_pill_number/initial_setting_select_today_pill_number_page.dart';
import 'package:pilll/domain/initial_setting/initial_setting_store.dart';
import 'package:pilll/components/atoms/buttons.dart';
import 'package:pilll/components/atoms/color.dart';
import 'package:pilll/components/atoms/text_color.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pilll/entity/pill_sheet_type.dart';

class InitialSettingPillSheetGroupPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final store = ref.watch(initialSettingStoreProvider.notifier);
final state = ref.watch(initialSettingStoreProvider);

return HUD(
shown: state.isLoading,
child: Scaffold(
backgroundColor: PilllColors.background,
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => Navigator.of(context).pop(),
),
title: const Text(
"2/4",
style: TextStyle(color: TextColor.black),
),
backgroundColor: PilllColors.white,
),
body: SafeArea(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Stack(
children: [
SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: 24),
Text(
"処方されるシートについて\n教えてください",
style: FontType.sBigTitle.merge(TextColorStyle.main),
textAlign: TextAlign.center,
),
InitialSettingPillSheetGroupPageBody(
state: state, store: store),
const SizedBox(height: 100),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
width: MediaQuery.of(context).size.width,
color: PilllColors.background,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (state.pillSheetTypes.isNotEmpty)
PrimaryButton(
text: "次へ",
onPressed: () async {
analytics.logEvent(
name: "next_to_today_pill_number");
Navigator.of(context).push(
InitialSettingSelectTodayPillNumberPageRoute
.route());
},
),
const SizedBox(height: 35),
],
),
),
),
],
),
),
),
),
);
}
}

class InitialSettingPillSheetGroupPageBody extends StatelessWidget {
const InitialSettingPillSheetGroupPageBody({
Key? key,
required this.state,
required this.store,
}) : super(key: key);

final InitialSettingState state;
final InitialSettingStateStore store;

@override
Widget build(BuildContext context) {
return Column(
children: [
const SizedBox(height: 6),
SettingPillSheetGroup(
pillSheetTypes: state.pillSheetTypes,
onAdd: (pillSheetType) {
analytics.logEvent(
name: "initial_setting_add_pill_sheet_group",
parameters: {"pill_sheet_type": pillSheetType.fullName});
store.addPillSheetType(pillSheetType);
},
onChange: (index, pillSheetType) {
analytics.logEvent(
name: "initial_setting_change_pill_sheet_group",
parameters: {
"index": index,
"pill_sheet_type": pillSheetType.fullName
});
store.changePillSheetType(index, pillSheetType);
},
onDelete: (index) {
analytics.logEvent(
name: "initial_setting_delete_pill_sheet_group",
parameters: {"index": index});
store.removePillSheetType(index);
}),
],
);
}
}

extension InitialSettingPillSheetGroupPageRoute
on InitialSettingPillSheetGroupPage {
static Route<dynamic> route() {
return MaterialPageRoute(
settings: const RouteSettings(name: "InitialSettingPillSheetGroupPage"),
builder: (_) => InitialSettingPillSheetGroupPage(),
);
}
}
Loading