大幅変更&環境バージョンアップ

This commit is contained in:
2024-08-22 14:35:09 +09:00
parent 56e9861c7a
commit dc58dc0584
446 changed files with 29645 additions and 8315 deletions

View File

@ -1,44 +1,82 @@
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:gifunavi/routes/app_pages.dart';
class HomePage extends GetView{
const HomePage({Key? key}) : super(key: key);
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
bool _isLocationServiceEnabled = true;
@override
void initState() {
super.initState();
/*
WidgetsBinding.instance.addPostFrameCallback((_) {
_checkLocationService(); // 非同期的に呼び出す
});
*/
_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),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _isLocationServiceEnabled
? () => Get.offNamed(AppPages.INDEX)
: () => _showLocationDisabledDialog(),
child: Text('start_app'.tr),
),
],
),
body: Container(),
),
);
}
}