Skip to content

Commit 82448a6

Browse files
committed
formatted
1 parent 5a39a00 commit 82448a6

File tree

3 files changed

+107
-53
lines changed

3 files changed

+107
-53
lines changed

lib/src/flutter/popup_menu.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,23 @@ class _VxPopupMenuState extends State<VxPopupMenu> {
209209
child: widget.child,
210210
onTap: () {
211211
if (widget.clickType == VxClickType.singleClick) {
212-
if(!_controller!.menuIsShowing){
213-
_showMenu();
214-
_controller!.menuIsShowing = true;
215-
}else{
212+
if (!_controller!.menuIsShowing) {
213+
_showMenu();
214+
_controller!.menuIsShowing = true;
215+
} else {
216216
_hideMenu();
217-
_controller!.menuIsShowing = false;
217+
_controller!.menuIsShowing = false;
218218
}
219219
}
220220
},
221221
onLongPress: () {
222222
if (widget.clickType == VxClickType.longClick) {
223-
if(!_controller!.menuIsShowing){
224-
_showMenu();
225-
_controller!.menuIsShowing = true;
226-
}else{
223+
if (!_controller!.menuIsShowing) {
224+
_showMenu();
225+
_controller!.menuIsShowing = true;
226+
} else {
227227
_hideMenu();
228-
_controller!.menuIsShowing = false;
228+
_controller!.menuIsShowing = false;
229229
}
230230
}
231231
},

lib/src/flutter/text.dart

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import 'velocityx_mixins/color_mixin.dart';
2525
/// overflows anyway, you should check if the parent widget actually constraints
2626
/// the size of this widget.
2727
@protected
28-
class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuilder> {
28+
class VxTextBuilder extends VxWidgetBuilder<Widget>
29+
with VxColorMixin<VxTextBuilder> {
2930
VxTextBuilder(String this._text) {
3031
setChildToColor(this);
3132
}
@@ -76,7 +77,8 @@ class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuil
7677
}
7778

7879
/// Set [color] of the text using hexvalue
79-
VxTextBuilder hexColor(String colorHex) => this..velocityColor = Vx.hexToColor(colorHex);
80+
VxTextBuilder hexColor(String colorHex) =>
81+
this..velocityColor = Vx.hexToColor(colorHex);
8082

8183
/// [LayoutBuilder] does not support using IntrinsicWidth or IntrinsicHeight.
8284
///
@@ -352,9 +354,11 @@ class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuil
352354
VxTextBuilder get xl6 => _fontSizedText(child: this, scaleFactor: 4);
353355

354356
/// Sets [textScaleFactor] to custom value
355-
VxTextBuilder scale(double value) => _fontSizedText(child: this, scaleFactor: value);
357+
VxTextBuilder scale(double value) =>
358+
_fontSizedText(child: this, scaleFactor: value);
356359

357-
VxTextBuilder _fontSizedText({required double scaleFactor, required VxTextBuilder child}) {
360+
VxTextBuilder _fontSizedText(
361+
{required double scaleFactor, required VxTextBuilder child}) {
358362
_fontSize = _fontSize ?? 14.0;
359363
_scaleFactor = scaleFactor;
360364
return this;
@@ -420,7 +424,8 @@ class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuil
420424
VxTextBuilder get underline => this.._decoration = TextDecoration.underline;
421425

422426
/// Sets [TextDecoration] as [TextDecoration.lineThrough]
423-
VxTextBuilder get lineThrough => this.._decoration = TextDecoration.lineThrough;
427+
VxTextBuilder get lineThrough =>
428+
this.._decoration = TextDecoration.lineThrough;
424429

425430
/// Sets [TextDecoration] as [TextDecoration.overline]
426431
VxTextBuilder get overline => this.._decoration = TextDecoration.overline;
@@ -453,10 +458,12 @@ class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuil
453458
VxTextBuilder lineHeight(double val) => this.._lineHeight = val;
454459

455460
/// Sets [Shadow] as specified in request *#127*
456-
VxTextBuilder shadow(double offsetX, double offsetY, double blurRadius, Color color) => this
457-
.._shadowBlur = blurRadius
458-
.._shadowColor = color
459-
.._shadowOffset = Offset(offsetX, offsetY);
461+
VxTextBuilder shadow(
462+
double offsetX, double offsetY, double blurRadius, Color color) =>
463+
this
464+
.._shadowBlur = blurRadius
465+
.._shadowColor = color
466+
.._shadowOffset = Offset(offsetX, offsetY);
460467

461468
/// Sets [Shadow] blur
462469
VxTextBuilder shadowBlur(double blur) => this.._shadowBlur = blur;
@@ -465,11 +472,15 @@ class VxTextBuilder extends VxWidgetBuilder<Widget> with VxColorMixin<VxTextBuil
465472
VxTextBuilder shadowColor(Color color) => this.._shadowColor = color;
466473

467474
/// Sets [Shadow] offset
468-
VxTextBuilder shadowOffset(double dx, double dy) => this.._shadowOffset = Offset(dx, dy);
475+
VxTextBuilder shadowOffset(double dx, double dy) =>
476+
this.._shadowOffset = Offset(dx, dy);
469477

470478
@override
471479
Widget make({Key? key}) {
472-
final sdw = [Shadow(blurRadius: _shadowBlur, color: _shadowColor, offset: _shadowOffset)];
480+
final sdw = [
481+
Shadow(
482+
blurRadius: _shadowBlur, color: _shadowColor, offset: _shadowOffset)
483+
];
473484

474485
final ts = TextStyle(
475486
color: velocityColor,

test/flutter/text_test.dart

Lines changed: 75 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import 'package:velocity_x/src/extensions/string_ext.dart';
1919
import 'package:velocity_x/velocity_x.dart';
2020

2121
void main() {
22-
Directionality getDirectionalityWidget({required Widget child}) => Directionality(
22+
Directionality getDirectionalityWidget({required Widget child}) =>
23+
Directionality(
2324
textDirection: TextDirection.ltr,
2425
child: child,
2526
);
@@ -51,7 +52,8 @@ void main() {
5152
});
5253

5354
group("Group all text tests", () {
54-
testWidgets('text used on String creates a Text Widget', (WidgetTester tester) async {
55+
testWidgets('text used on String creates a Text Widget',
56+
(WidgetTester tester) async {
5557
await tester.pumpWidget(
5658
getDirectionalityWidget(
5759
child: 'VelocityX'.text.make(),
@@ -64,7 +66,8 @@ void main() {
6466
);
6567
});
6668

67-
testWidgets('Text widget responds to Font Scale', (WidgetTester tester) async {
69+
testWidgets('Text widget responds to Font Scale',
70+
(WidgetTester tester) async {
6871
await tester.pumpWidget(
6972
getDirectionalityWidget(
7073
child: 'VelocityX'.text.xs.make(),
@@ -78,7 +81,8 @@ void main() {
7881
);
7982
});
8083

81-
testWidgets('Text widget responds to fontSize', (WidgetTester tester) async {
84+
testWidgets('Text widget responds to fontSize',
85+
(WidgetTester tester) async {
8286
await tester.pumpWidget(
8387
getDirectionalityWidget(
8488
child: "VelocityX".text.size(24).make(),
@@ -91,7 +95,8 @@ void main() {
9195
);
9296
});
9397

94-
testWidgets('Text widget responds to FontWeight', (WidgetTester tester) async {
98+
testWidgets('Text widget responds to FontWeight',
99+
(WidgetTester tester) async {
95100
await tester.pumpWidget(
96101
getDirectionalityWidget(
97102
child: 'VelocityX'.text.medium.make(),
@@ -100,70 +105,108 @@ void main() {
100105

101106
// Font Weight for medium is 500
102107
expect(
103-
tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.fontWeight,
108+
tester
109+
.widget<AutoSizeText>(find.byType(AutoSizeText))
110+
.style!
111+
.fontWeight,
104112
FontWeight.w500,
105113
);
106114
});
107115

108-
testWidgets('Text widget responds to FontStyle', (WidgetTester tester) async {
109-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.italic.make()));
116+
testWidgets('Text widget responds to FontStyle',
117+
(WidgetTester tester) async {
118+
await tester.pumpWidget(
119+
getDirectionalityWidget(child: 'VelocityX'.text.italic.make()));
110120

111121
expect(
112122
tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.fontStyle,
113123
FontStyle.italic,
114124
);
115125
});
116126

117-
testWidgets('Text widget responds to alignment', (WidgetTester tester) async {
118-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.start.make()));
127+
testWidgets('Text widget responds to alignment',
128+
(WidgetTester tester) async {
129+
await tester.pumpWidget(
130+
getDirectionalityWidget(child: 'VelocityX'.text.start.make()));
119131

120-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).textAlign, TextAlign.start);
132+
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).textAlign,
133+
TextAlign.start);
121134
});
122135

123-
testWidgets('Text widget responds to letter spacing', (WidgetTester tester) async {
124-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.tightest.make()));
136+
testWidgets('Text widget responds to letter spacing',
137+
(WidgetTester tester) async {
138+
await tester.pumpWidget(
139+
getDirectionalityWidget(child: 'VelocityX'.text.tightest.make()));
125140

126-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.letterSpacing, -3.0);
141+
expect(
142+
tester
143+
.widget<AutoSizeText>(find.byType(AutoSizeText))
144+
.style!
145+
.letterSpacing,
146+
-3.0);
127147
});
128148

129-
testWidgets('Text widget responds to custom letter spacing', (WidgetTester tester) async {
130-
await tester
131-
.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.letterSpacing(4.0).make()));
149+
testWidgets('Text widget responds to custom letter spacing',
150+
(WidgetTester tester) async {
151+
await tester.pumpWidget(getDirectionalityWidget(
152+
child: 'VelocityX'.text.letterSpacing(4.0).make()));
132153

133-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.letterSpacing, 4.0);
154+
expect(
155+
tester
156+
.widget<AutoSizeText>(find.byType(AutoSizeText))
157+
.style!
158+
.letterSpacing,
159+
4.0);
134160
});
135161

136-
testWidgets('Text widget responds to TextDecoration', (WidgetTester tester) async {
137-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.underline.make()));
162+
testWidgets('Text widget responds to TextDecoration',
163+
(WidgetTester tester) async {
164+
await tester.pumpWidget(
165+
getDirectionalityWidget(child: 'VelocityX'.text.underline.make()));
138166

139-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.decoration,
167+
expect(
168+
tester
169+
.widget<AutoSizeText>(find.byType(AutoSizeText))
170+
.style!
171+
.decoration,
140172
TextDecoration.underline);
141173
});
142174

143-
testWidgets('Text widget responds to line height', (WidgetTester tester) async {
144-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.heightSnug.make()));
175+
testWidgets('Text widget responds to line height',
176+
(WidgetTester tester) async {
177+
await tester.pumpWidget(
178+
getDirectionalityWidget(child: 'VelocityX'.text.heightSnug.make()));
145179

146180
// Line Height or heightSnug is 0.875
147-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.height, 0.875);
181+
expect(
182+
tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.height,
183+
0.875);
148184
});
149185

150-
testWidgets('Text widget responds to text utilities', (WidgetTester tester) async {
151-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.uppercase.make()));
186+
testWidgets('Text widget responds to text utilities',
187+
(WidgetTester tester) async {
188+
await tester.pumpWidget(
189+
getDirectionalityWidget(child: 'VelocityX'.text.uppercase.make()));
152190

153-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).data, 'VELOCITYX');
191+
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).data,
192+
'VELOCITYX');
154193
});
155194

156195
testWidgets('key is properly assigned', (WidgetTester tester) async {
157-
await tester.pumpWidget(
158-
getDirectionalityWidget(child: 'VelocityX'.text.uppercase.make(key: const Key("key"))));
196+
await tester.pumpWidget(getDirectionalityWidget(
197+
child: 'VelocityX'.text.uppercase.make(key: const Key("key"))));
159198

160-
expect(tester.widget(find.byKey(const Key('key'))).runtimeType, AutoSizeText);
199+
expect(tester.widget(find.byKey(const Key('key'))).runtimeType,
200+
AutoSizeText);
161201
});
162202

163203
testWidgets('Text widget responds to color', (WidgetTester tester) async {
164-
await tester.pumpWidget(getDirectionalityWidget(child: 'VelocityX'.text.red300.make()));
204+
await tester.pumpWidget(
205+
getDirectionalityWidget(child: 'VelocityX'.text.red300.make()));
165206

166-
expect(tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.color, Vx.red300);
207+
expect(
208+
tester.widget<AutoSizeText>(find.byType(AutoSizeText)).style!.color,
209+
Vx.red300);
167210
});
168211
});
169212
}

0 commit comments

Comments
 (0)