clean up
This commit is contained in:
66
lib/pages/widgets/task_button.dart
Normal file
66
lib/pages/widgets/task_button.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
typedef BtnCallback();
|
||||
|
||||
/// TaskButton is used to navigate to eash task
|
||||
class TaskButton extends StatelessWidget {
|
||||
final String titleKey;
|
||||
final IconData icon;
|
||||
final BtnCallback btnCallback;
|
||||
|
||||
const TaskButton(this.titleKey, {Key key, this.icon, this.btnCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
return InkWell(
|
||||
onTap: btnCallback != null ? btnCallback : () => {},
|
||||
child: Container(
|
||||
width: 120,
|
||||
height: 140,
|
||||
padding: EdgeInsets.only(top: 10.0, left: 5, right: 5),
|
||||
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(
|
||||
width: 60,
|
||||
height: 60,
|
||||
child: Icon(icon, color: Colors.white, size: 30)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 60,
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text(AppTranslations.of(context).text(titleKey),
|
||||
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,
|
||||
fontFamily: "Myanmar3")),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user