Files
fcs/lib/pages/widgets/task_button.dart

68 lines
2.3 KiB
Dart
Raw Normal View History

2020-10-12 03:34:05 +06:30
import 'package:fcs/helpers/theme.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
2020-09-04 15:30:10 +06:30
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
typedef BtnCallback();
2020-10-07 02:33:06 +06:30
/// TaskButton is used to navigate to eash task
class TaskButton extends StatelessWidget {
final String titleKey;
2020-09-04 15:30:10 +06:30
final IconData icon;
final BtnCallback btnCallback;
2020-10-07 02:33:06 +06:30
const TaskButton(this.titleKey, {Key key, this.icon, this.btnCallback})
2020-09-04 15:30:10 +06:30
: super(key: key);
@override
Widget build(BuildContext context) {
var languageModel = Provider.of<LanguageModel>(context);
return InkWell(
onTap: btnCallback != null ? btnCallback : () => {},
child: Container(
width: 120,
2020-10-12 03:34:05 +06:30
height: 155,
2020-10-09 02:42:21 +06:30
padding: EdgeInsets.only(top: 0.0, left: 5, right: 5),
2020-09-04 15:30:10 +06:30
decoration: new BoxDecoration(
color: Colors.transparent,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0))),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(children: <Widget>[
ClipOval(
child: Material(
color: Colors.black54, // button color
child: SizedBox(
2020-10-09 02:42:21 +06:30
width: 100,
height: 100,
child: Icon(icon, color: Colors.white, size: 50)),
2020-09-04 15:30:10 +06:30
),
),
Container(
2020-10-12 03:34:05 +06:30
height: 45,
2020-09-04 15:30:10 +06:30
alignment: Alignment.topCenter,
2020-10-07 02:33:06 +06:30
child: Text(AppTranslations.of(context).text(titleKey),
2020-09-04 15:30:10 +06:30
textAlign: TextAlign.center,
style: languageModel.isEng
? TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 15.0,
fontFamily: "Roboto")
: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w500,
fontSize: 14.0,
2020-10-07 02:33:06 +06:30
fontFamily: "Myanmar3")),
2020-09-04 15:30:10 +06:30
),
]),
),
),
);
}
}