審査用に文言などを修正 ver.4.5.1 467
This commit is contained in:
@ -1,46 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/search/search_page.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/utils/string_values.dart';
|
||||
|
||||
// 要検討:SearchPageへのナビゲーションにNavigator.pushを使用していますが、一貫性のためにGet.toやGet.toNamedを使用することを検討してください。
|
||||
//
|
||||
class HomePage extends GetView{
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
class HomePage extends StatefulWidget {
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
bool _isLocationServiceEnabled = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_checkLocationService();
|
||||
}
|
||||
|
||||
Future<void> _checkLocationService() async {
|
||||
final serviceEnabled = await Permission.location.serviceStatus.isEnabled;
|
||||
setState(() {
|
||||
_isLocationServiceEnabled = serviceEnabled;
|
||||
});
|
||||
}
|
||||
|
||||
void _showLocationDisabledDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('location_disabled_title'.tr),
|
||||
content: Text('location_disabled_message'.tr),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text('ok'.tr),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
TextButton(
|
||||
child: Text('open_settings'.tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
openAppSettings();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("app_title".tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
width: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
|
||||
),
|
||||
child: const Center(child: Icon(Icons.search),),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: Text('home'.tr),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text('welcome'.tr),
|
||||
SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: _isLocationServiceEnabled
|
||||
? () => Get.offNamed(AppPages.INDEX)
|
||||
: () => _showLocationDisabledDialog(),
|
||||
child: Text('start_app'.tr),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Container(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user