build method
Implementation
@override
Widget build(BuildContext context, IPermissionViewModel viewModel) {
return Card(
color: _background(viewModel),
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
elevation: viewModel.state == PermissionViewState.Granted ? 0 : 4,
child: InkWell(
onTap: viewModel.isGranted
? null
: () async {
await viewModel.requestPermission();
if (onPressed != null) {
onPressed!();
}
},
child: Container(
padding: EdgeInsets.only(left: 8, right: 8, top: 16, bottom: 16),
width: double.infinity,
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Container(
margin: EdgeInsets.only(right: 8),
child: viewModel.icon(),
),
Container(
child: FixedScaleText(
text: Text(
viewModel.title,
style: TextStyle(
color: Colors.blueGrey.shade700,
fontSize: 16,
fontWeight: FontWeight.bold),
))),
]),
SizedBox(height: 16),
Container(
margin: EdgeInsets.only(left: 8),
child: Text(viewModel.description)),
SizedBox(height: 16),
Container(
margin: EdgeInsets.only(left: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_action(viewModel),
SizedBox(width: 8),
Expanded(
child:
FixedScaleText(text: Text(viewModel.statusMessage)))
],
),
),
viewModel.isPermanentlyDenied
? Container(
margin: EdgeInsets.only(top: 16, left: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: [
FixedScaleText(
text: Text(
"앱 세팅에서 가서 권한을 부여해주세요",
style: TextStyle(
color: Colors.blue.shade700,
fontSize: 14,
fontWeight: FontWeight.bold),
)),
Icon(Icons.arrow_forward_ios_sharp,
color: Colors.blue.shade700, size: 16)
]),
)
: Container(),
]),
),
),
);
}