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

Fix/frontend/nursery/create bus #214

Merged
merged 9 commits into from
Feb 24, 2024
2 changes: 1 addition & 1 deletion frontend/where_child_bus/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import flutter_config
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey(FlutterConfigPlugin.env(for: "IOS_GOOGLE_MAP_API_KEY"))
GMSServices.setMetalRendererEnabled(true)
// GMSServices.setMetalRendererEnabled(true)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class _AuthPageState extends State<AuthPage> {
NurseryLoginResponse res;
try {
if (kDebugMode) {
res = await nurseryLogin("demo@example.com", "password");
res = await nurseryLogin("paopao@example.com", "password");
} else {
res =
await nurseryLogin(_emailController.text, _passwordController.text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class _BusGuardianManagePageState extends State<BusGuardianManagePage> {
],
),
),
SizedBox(
height: 100,
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: ConfirmButton(
buttonText: "保存",
onTap: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/con
import 'package:where_child_bus/pages/bus_list_page/bus_edit_page/components/input_element.dart';
import 'package:where_child_bus/service/create_bus.dart';
import 'package:where_child_bus/service/update_bus.dart';
import 'package:where_child_bus/util/api/bus.dart';
import 'package:where_child_bus/util/validation/create_bus_validation.dart';
import 'package:where_child_bus_api/proto-gen/where_child_bus/v1/resources.pb.dart';

Expand Down Expand Up @@ -112,6 +111,12 @@ class _BusEditPageState extends State<BusEditPage> {
developer.log("バスの更新中にエラーが発生しました",
error: e, name: "BusUpdateButtonError");
}
} finally {
if (mounted) {
setState(() {
_isCreatingBus = false;
});
}
}
}

Expand Down Expand Up @@ -140,6 +145,12 @@ class _BusEditPageState extends State<BusEditPage> {
if (kDebugMode) {
developer.log("バスの作成中にエラーが発生しました: $e");
}
} finally {
if (mounted) {
setState(() {
_isCreatingBus = false;
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ class ConfirmButton extends StatelessWidget {
}

Widget confirmButton(BuildContext context) {
return Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.6,
height: fontSize * 2,
child: ElevatedButton(
onPressed: onTap ?? () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
),
child: Text(
buttonText,
style: buttonTextStyle(),
),
return Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.6,
height: fontSize * 2,
child: ElevatedButton(
onPressed: onTap ?? () {},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
),
child: Text(
buttonText,
style: buttonTextStyle(),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ class _BusListPageState extends State<BusListPage> {

Widget _createAddBusButton() {
return FloatingActionButton(
onPressed: () {
onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const BusEditPage(
busEditPageType: BusEditPageType.create,
)));
await _fetchBusList();
},
child: const Icon(Icons.add),
);
Expand Down Expand Up @@ -152,6 +153,7 @@ class _BusListPageState extends State<BusListPage> {
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BusImage(busStatus: bus.busStatus),
_createBusNameAndDescription(bus.name, bus.busStatus),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,32 +128,29 @@ class _CreateStationPageState extends State<CreateStationPage> {
? Container()
: SizedBox(
width: MediaQuery.of(context).size.width,
child: Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(10),
child: Text(
'${guardians[_index].name}さん',
style: const TextStyle(fontSize: 20),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(10),
child: Text(
'${guardians[_index].name}さん',
style: const TextStyle(fontSize: 20),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
child: PositionDecideButton(
onPressed:
_markers.isNotEmpty ? _onButtonPressed : () {},
text: _markers.isNotEmpty
? 'バス停を決定する'
: '地図をタップしてバス停を決定してください',
isLoading: _isLoadingUpdate,
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 8.0),
child: PositionDecideButton(
onPressed:
_markers.isNotEmpty ? _onButtonPressed : () {},
text: _markers.isNotEmpty
? 'バス停を決定する'
: '地図をタップしてバス停を決定してください',
isLoading: _isLoadingUpdate,
),
],
),
),
],
),
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class _CameraPageState extends State<CameraPage> {
int frameCounter = 0;
_controller.startImageStream((CameraImage image) async {
frameCounter++;
if (frameCounter % 60 == 0) {
if (frameCounter % 45 == 0) {
if (Platform.isAndroid) {
videoChunks.add(image.planes[0].bytes.toList());
_streamController.add(StreamBusVideoRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GoogleMapAPIManager {
if (_lastApiCallTimestamps.containsKey(apiName)) {
final durationSinceLastCall =
DateTime.now().difference(_lastApiCallTimestamps[apiName]!);
if (durationSinceLastCall.inSeconds < 60) {
if (durationSinceLastCall.inSeconds < 3) {
throw Exception(
'Too many requests: $apiName can only be called once per minute.');
}
Expand Down
Loading