-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathheader_button.dart
More file actions
67 lines (59 loc) · 1.86 KB
/
header_button.dart
File metadata and controls
67 lines (59 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:kartal/kartal.dart';
import '../../../core/init/lang/locale_keys.g.dart';
class HeaderButton extends StatelessWidget {
final String titleText;
final VoidCallback onPressed;
const HeaderButton({Key key, this.titleText, this.onPressed})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: context.horizontalPaddingLow,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [buildTextTitle(context), buildFlatButtonRight(context)],
),
);
}
Text buildTextTitle(BuildContext context) {
return Text(
titleText.tr(),
style: context.textTheme.headline6
.copyWith(color: context.colorScheme.onError),
);
}
TextButton buildFlatButtonRight(BuildContext context) {
return TextButton(
onPressed: () {
onPressed();
},
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text(LocaleKeys.home_game_viewAll.tr(),
style: context.textTheme.subtitle2
.copyWith(color: context.colorScheme.onError)),
Icon(Icons.arrow_right, color: context.colorScheme.onError)
],
),
style: ButtonStyle(padding: MaterialStateProperty.all(EdgeInsets.zero)),
);
}
}
/*
BEFORE: Flutter 2.0
FlatButton(
padding: EdgeInsets.zero,
onPressed: () {
onPressed();
},
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text(LocaleKeys.home_game_viewAll.tr(), style: context.textTheme.subtitle2.copyWith(color: context.colorScheme.onError)),
Icon(Icons.arrow_right, color: context.colorScheme.onError)
],
));
*/