Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6ef9456

Browse filesBrowse files
authored
Merge pull request #160 from moein-keyvani-pur/master
add font family to tab item package
2 parents 1a21afc + 46d4cb3 commit 6ef9456
Copy full SHA for 6ef9456
Expand file treeCollapse file tree

12 files changed

+21
-16
lines changed

‎example/lib/custom_appbar_sample.dart

Copy file name to clipboardExpand all lines: example/lib/custom_appbar_sample.dart
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class Style extends StyleHook {
210210
double get iconSize => 20;
211211

212212
@override
213-
TextStyle textStyle(Color color) {
214-
return TextStyle(fontSize: 20, color: color);
213+
TextStyle textStyle(Color color, String fontFamily) {
214+
return TextStyle(fontSize: 20, color: color, fontFamily: fontFamily);
215215
}
216216
}

‎lib/src/interface.dart

Copy file name to clipboardExpand all lines: lib/src/interface.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ abstract class StyleHook {
7575
/// Warning:
7676
/// Override the text size can lead to `layout overflow` warning, you may need
7777
/// to update the height of bar too.
78-
TextStyle textStyle(Color color);
78+
TextStyle textStyle(Color color, String? fontFamily);
7979

8080
/// For styles with both ICON and label, omit the Text widget when label is null/empty
8181
bool get hideEmptyLabel {

‎lib/src/item.dart

Copy file name to clipboardExpand all lines: lib/src/item.dart
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import 'package:flutter/cupertino.dart';
1818

1919
/// Tab item used for [ConvexAppBar].
2020
class TabItem<T> {
21+
// this code is added by moein
22+
final String? fontFamily;
23+
2124
/// Tab text.
2225
final String? title;
2326

@@ -35,6 +38,7 @@ class TabItem<T> {
3538

3639
/// Create item
3740
const TabItem({
41+
this.fontFamily,
3842
this.title = '',
3943
required this.icon,
4044
this.activeIcon,

‎lib/src/style/fixed_circle_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/fixed_circle_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class FixedCircleTabStyle extends InnerBuilder {
4343
var c = active ? activeColor : color;
4444
var item = items[index];
4545
var style = ofStyle(context);
46-
var textStyle = style.textStyle(c);
46+
var textStyle = style.textStyle(c, item.fontFamily);
4747
var margin = style.activeIconMargin;
4848

4949
if (index == convexIndex) {

‎lib/src/style/fixed_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/fixed_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class FixedTabStyle extends InnerBuilder {
3939
Widget build(BuildContext context, int index, bool active) {
4040
var c = active ? activeColor : color;
4141
var style = ofStyle(context);
42-
var textStyle = style.textStyle(c);
4342
var item = items[index];
43+
var textStyle = style.textStyle(c, item.fontFamily);
4444

4545
if (index == convexIndex) {
4646
var item = items[convexIndex];

‎lib/src/style/flip_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/flip_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FlipTabStyle extends InnerBuilder {
3838
Widget build(BuildContext context, int index, bool active) {
3939
var item = items[index];
4040
var style = ofStyle(context);
41-
var textStyle = style.textStyle(activeColor);
41+
var textStyle = style.textStyle(activeColor, item.fontFamily);
4242

4343
if (active) {
4444
var children = <Widget>[

‎lib/src/style/internal_style_config.dart

Copy file name to clipboardExpand all lines: lib/src/style/internal_style_config.dart
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class InternalStyle extends StyleHook {
3737
}
3838

3939
@override
40-
TextStyle textStyle(Color color) {
41-
return TextStyle(color: color);
40+
TextStyle textStyle(Color color, String? fontFamily) {
41+
return TextStyle(color: color, fontFamily: fontFamily);
4242
}
4343
}

‎lib/src/style/react_circle_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/react_circle_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ReactCircleTabStyle extends InnerBuilder {
6666
),
6767
);
6868
}
69-
var textStyle = style.textStyle(color);
69+
var textStyle = style.textStyle(color, item.fontFamily);
7070
var noLabel = style.hideEmptyLabel && hasNoText(item);
7171
var children = <Widget>[
7272
BlendImageIcon(

‎lib/src/style/react_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/react_tab_style.dart
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class ReactTabStyle extends InnerBuilder {
5353
),
5454
];
5555
if (!noLabel) {
56-
children
57-
.add(Text(item.title ?? '', style: style.textStyle(activeColor)));
56+
children.add(Text(item.title ?? '',
57+
style: style.textStyle(activeColor, item.fontFamily)));
5858
}
5959
return Container(
6060
padding: const EdgeInsets.only(bottom: 2),
@@ -69,7 +69,8 @@ class ReactTabStyle extends InnerBuilder {
6969
BlendImageIcon(item.icon, color: item.blend ? color : null),
7070
];
7171
if (!noLabel) {
72-
children.add(Text(item.title ?? '', style: style.textStyle(color)));
72+
children.add(Text(item.title ?? '',
73+
style: style.textStyle(color, item.fontFamily)));
7374
}
7475
return Container(
7576
padding: const EdgeInsets.only(bottom: 2),

‎lib/src/style/textin_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/textin_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TextInTabStyle extends InnerBuilder {
3939
var item = items[index];
4040
var style = ofStyle(context);
4141
if (active) {
42-
var textStyle = style.textStyle(activeColor);
42+
var textStyle = style.textStyle(activeColor, item.fontFamily);
4343
return Container(
4444
padding: const EdgeInsets.only(bottom: 2),
4545
child: Column(

‎lib/src/style/titled_tab_style.dart

Copy file name to clipboardExpand all lines: lib/src/style/titled_tab_style.dart
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class TitledTabStyle extends InnerBuilder {
7171
);
7272
}
7373

74-
var textStyle = style.textStyle(activeColor);
74+
var textStyle = style.textStyle(activeColor, item.fontFamily);
7575
if (pre == index) {
7676
return Stack(
7777
clipBehavior: Clip.hardEdge,

‎test/provider_test.dart

Copy file name to clipboardExpand all lines: test/provider_test.dart
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class Style extends StyleHook {
6767
}
6868

6969
@override
70-
TextStyle textStyle(Color color) {
71-
return TextStyle(color: color);
70+
TextStyle textStyle(Color color, String? fontFamily) {
71+
return TextStyle(color: color, fontFamily: fontFamily);
7272
}
7373

7474
@override

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.