import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/retrofit/data/activity_pos.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:permission_handler/permission_handler.dart'; import '../retrofit/data/login_info.dart'; import '../utils/font_weight.dart'; import 'custom_image.dart'; import 'new_people_reward.dart'; class LocationTips extends StatefulWidget { final Function disMissLocationTips; LocationTips(this.disMissLocationTips); @override State createState() { return _LocationTips(); } } class _LocationTips extends State { @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Container( width: double.infinity, padding: EdgeInsets.all(10), margin: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 15.h), decoration: new BoxDecoration( color: Colors.black.withOpacity(0.8), borderRadius: BorderRadius.circular(10), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Text( // "访问精确地理位置信息权限说明", "定位服务未开启", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.regular, color: Colors.white, ), ), SizedBox( height: 3.h, ), Text( // "为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息,不授权该权限不影响app正常使用。", "开启后才能提供更详细的定位服务哦!", style: TextStyle( fontSize: 13.sp, fontWeight: MyFontWeight.regular, color: Colors.white, ), ), ], ), ), GestureDetector( child: Container( child: Text( "去开启", style: TextStyle( fontSize: 13.sp, fontWeight: MyFontWeight.regular, color: Colors.white, ), ), margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 15.h), padding: EdgeInsets.symmetric(vertical: 2.h, horizontal: 10.w), decoration: BoxDecoration( color: Colors.green, borderRadius: BorderRadius.circular(100), ), ), onTap: () async { if (!await openAppSettings()) { SmartDialog.showToast("打开应用设置失败,请手动前往系统设置中心开启应用位置权限", alignment: Alignment.center); } }, behavior: HitTestBehavior.opaque, ), GestureDetector( behavior: HitTestBehavior.opaque, child: Container( child: Icon( Icons.close, color: Colors.white.withOpacity(0.8), size: 10, ), decoration: BoxDecoration( color: Colors.black.withOpacity(0.8), borderRadius: BorderRadius.circular(100), ), padding: EdgeInsets.all(3), ), onTap: () { widget.disMissLocationTips(); }, ) ], ), ); } }