You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.1 KiB

4 years ago
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
class PermissionSettingPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _PermissionSettingPage();
}
}
class _PermissionSettingPage extends State<PermissionSettingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
S.of(context).quanxianshezhi,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
centerTitle: false,
backgroundColor: Color(0xFFF7F7F7),
elevation: 0,
leading: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
),
),
titleSpacing: 2,
leadingWidth: 56,
),
body: Container(
child: ListView.builder(
itemCount: 4,
itemBuilder: (context, position) {
return buildPermissionItem(
title[position], icons[position], contents[position]);
}),
),
);
}
List<String> title = [
S.current.dingwei,
S.current.tongzhi,
S.current.xiangji,
"Face ID",
];
List<String> icons = [
"assets/image/icon_permission_location.png",
"assets/image/icon_permission_notices.png",
"assets/image/icon_permission_camera.png",
"assets/image/icon_permission_face_id.png",
];
List<String> contents = [
S.current.weizhitishixinxi,
S.current.tongzhitishixinxi,
S.current.xiangjitishixinxi,
S.current.faceidtishixinxi,
];
Widget buildPermissionItem(title, icon, content) {
return Container(
margin: EdgeInsets.fromLTRB(16, 8, 16, 8),
padding: EdgeInsets.fromLTRB(20, 16, 20, 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0)
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
children: [
Row(
children: [
Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold),
),
SizedBox(
width: 8,
),
Image.asset(
icon,
width: 22,
height: 22,
)
],
),
SizedBox(
height: 8,
),
Text(
content,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
color: Color(0xFF353535),
fontSize: 12,
),
),
],
),
),
SizedBox(
width: 32,
),
Row(
children: [
Text(
S.of(context).weikaiqi,
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 12,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Color(0xFF32A060),
)
],
),
],
),
);
}
}