refactor(tests): replace 'final' with 'const' for improved performance in various test files

This commit is contained in:
mso7nueh
2025-12-08 11:32:40 +03:00
parent c2a506cdbf
commit 746d366c18
56 changed files with 199 additions and 254 deletions

View File

@@ -12,7 +12,7 @@ void main() {
home: Scaffold(
body: ChipGroup(
selectedChipIndex: 0,
chipsLabelList: ['All', 'Recipes', 'Diets'],
chipsLabelList: const ['All', 'Recipes', 'Diets'],
setSelectedChipIndex: (index) {},
),
),
@@ -29,7 +29,7 @@ void main() {
home: Scaffold(
body: ChipGroup(
selectedChipIndex: 0,
chipsLabelList: ['All', 'Recipes', 'Diets', 'Plans'],
chipsLabelList: const ['All', 'Recipes', 'Diets', 'Plans'],
setSelectedChipIndex: (index) {},
),
),
@@ -51,7 +51,7 @@ void main() {
home: Scaffold(
body: ChipGroup(
selectedChipIndex: 0,
chipsLabelList: ['All', 'Recipes', 'Diets'],
chipsLabelList: const ['All', 'Recipes', 'Diets'],
setSelectedChipIndex: (index) {
selectedIndex = index;
},
@@ -73,7 +73,7 @@ void main() {
home: Scaffold(
body: ChipGroup(
selectedChipIndex: 0,
chipsLabelList: [],
chipsLabelList: const [],
setSelectedChipIndex: (index) {},
),
),

View File

@@ -11,7 +11,7 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1', 'Option 2'],
chipsLabelList: const ['Option 1', 'Option 2'],
index: 0,
selectedChipIndex: 0,
onSelected: (selected) {},
@@ -30,7 +30,7 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1', 'Option 2'],
chipsLabelList: const ['Option 1', 'Option 2'],
index: 0,
selectedChipIndex: 0,
onSelected: (selected) {},
@@ -50,7 +50,7 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1', 'Option 2'],
chipsLabelList: const ['Option 1', 'Option 2'],
index: 1,
selectedChipIndex: 0,
onSelected: (selected) {},
@@ -70,10 +70,10 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1'],
chipsLabelList: const ['Option 1'],
index: 0,
selectedChipIndex: 0,
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
onSelected: (selected) {},
),
),
@@ -89,7 +89,7 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1'],
chipsLabelList: const ['Option 1'],
index: 0,
selectedChipIndex: 0,
activeColor: Colors.blue,
@@ -110,7 +110,7 @@ void main() {
theme: ThemeHelper().themeData(),
home: Scaffold(
body: ChoiceChipWidget(
chipsLabelList: ['Option 1'],
chipsLabelList: const ['Option 1'],
index: 0,
selectedChipIndex: 0,
onSelected: (selected) {

View File

@@ -34,7 +34,7 @@ void main() {
Widget createTestWidget(FeedConsultantModel consultant) {
return MaterialApp.router(
theme: ThemeHelper().themeData(),
localizationsDelegates: [
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
@@ -66,7 +66,7 @@ void main() {
testWidgets('displays consultant information', (tester) async {
await mockNetworkImagesFor(() async {
final consultant = FeedConsultantModel(
const consultant = FeedConsultantModel(
slug: 'test-consultant',
name: 'Test Consultant',
photo: 'https://example.com/photo.jpg',
@@ -87,7 +87,7 @@ void main() {
testWidgets('displays consultant with badges', (tester) async {
await mockNetworkImagesFor(() async {
final consultant = FeedConsultantModel(
const consultant = FeedConsultantModel(
slug: 'test-consultant',
name: 'Test Consultant',
photo: 'https://example.com/photo.jpg',
@@ -110,7 +110,7 @@ void main() {
testWidgets('displays rating place', (tester) async {
await mockNetworkImagesFor(() async {
final consultant = FeedConsultantModel(
const consultant = FeedConsultantModel(
slug: 'test-consultant',
name: 'Test Consultant',
photo: 'https://example.com/photo.jpg',
@@ -129,7 +129,7 @@ void main() {
testWidgets('handles photo with https URL', (tester) async {
await mockNetworkImagesFor(() async {
final consultant = FeedConsultantModel(
const consultant = FeedConsultantModel(
slug: 'test-consultant',
name: 'Test Consultant',
photo: 'https://example.com/photo.jpg',
@@ -148,7 +148,7 @@ void main() {
testWidgets('handles photo without https URL', (tester) async {
await mockNetworkImagesFor(() async {
final consultant = FeedConsultantModel(
const consultant = FeedConsultantModel(
slug: 'test-consultant',
name: 'Test Consultant',
photo: '/storage/photo.jpg',

View File

@@ -41,7 +41,7 @@ void main() {
Widget createTestWidget(Widget child) {
return MaterialApp(
theme: ThemeHelper().themeData(),
localizationsDelegates: [
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,

View File

@@ -9,11 +9,9 @@ void main() {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
home: const Scaffold(
body: FilterBadge(
filterBottomSheet: Container(
child: Text('Filter Bottom Sheet'),
),
filterBottomSheet: Text('Filter Bottom Sheet'),
),
),
),
@@ -27,11 +25,9 @@ void main() {
await tester.pumpWidget(
MaterialApp(
theme: ThemeHelper().themeData(),
home: Scaffold(
home: const Scaffold(
body: FilterBadge(
filterBottomSheet: Container(
child: Text('Filter Bottom Sheet'),
),
filterBottomSheet: Text('Filter Bottom Sheet'),
),
),
),

View File

@@ -31,7 +31,7 @@ void main() {
Widget createTestWidget(Widget child) {
return MaterialApp(
theme: ThemeHelper().themeData(),
localizationsDelegates: [
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,

View File

@@ -41,7 +41,7 @@ void main() {
Widget createTestWidget(Widget child) {
return MaterialApp(
theme: ThemeHelper().themeData(),
localizationsDelegates: [
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,