Skip to content

Commit 67d8352

Browse files
committed
relpace depricated withOPacity to withValues
1 parent aba3a74 commit 67d8352

File tree

49 files changed

+808
-851
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+808
-851
lines changed

lib/core/auth/login/login_page.dart

Lines changed: 98 additions & 90 deletions
Large diffs are not rendered by default.

lib/core/auth/login/select_region/choose_region_screen.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ChooseRegionScreen extends TbContextStatelessWidget {
2828
title: Text(
2929
S.of(context).chooseRegion,
3030
style: TbTextStyles.titleXs.copyWith(
31-
color: Colors.black.withOpacity(.87),
31+
color: Colors.black.withValues(alpha: .87),
3232
),
3333
),
3434
),
@@ -55,8 +55,10 @@ class ChooseRegionScreen extends TbContextStatelessWidget {
5555
selected: europeSelected,
5656
onTap: () {
5757
getIt<IEndpointService>().setRegion(Region.europe);
58-
getIt<ThingsboardAppRouter>()
59-
.navigateTo('/', replace: true);
58+
getIt<ThingsboardAppRouter>().navigateTo(
59+
'/',
60+
replace: true,
61+
);
6062
},
6163
),
6264
),

lib/core/auth/login/select_region/region_widget.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ class RegionWidget extends StatelessWidget {
2828
Text(
2929
title,
3030
style: TbTextStyles.labelMedium.copyWith(
31-
color: selected
32-
? Theme.of(context).primaryColor
33-
: Colors.black.withOpacity(.76),
31+
color:
32+
selected
33+
? Theme.of(context).primaryColor
34+
: Colors.black.withValues(alpha: .76),
3435
),
3536
),
3637
Text(
3738
subTitle,
3839
style: TbTextStyles.labelSmall.copyWith(
39-
color: Colors.black.withOpacity(.38),
40+
color: Colors.black.withValues(alpha: .38),
4041
),
4142
),
4243
],

lib/core/auth/login/select_region/select_region_screen.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ class SelectRegionScreen extends TbContextStatelessWidget {
2828
Text(
2929
S.of(context).selectRegion,
3030
style: TbTextStyles.titleMedium.copyWith(
31-
color: Colors.black.withOpacity(.76),
31+
color: Colors.black.withValues(alpha: .76),
3232
),
3333
),
3434
const SizedBox(height: 16),
3535
SizedBox(
3636
width: double.infinity,
3737
child: ElevatedButton(
3838
onPressed: () {
39-
getIt<IEndpointService>()
40-
.setRegion(Region.northAmerica);
39+
getIt<IEndpointService>().setRegion(
40+
Region.northAmerica,
41+
);
4142
getIt<ThingsboardAppRouter>().navigateTo('/');
4243
},
4344
style: ElevatedButton.styleFrom(

lib/core/auth/noauth/presentation/widgets/endpoint_name_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class EndpointNameWidget extends StatelessWidget {
1111
return Container(
1212
decoration: BoxDecoration(
1313
borderRadius: BorderRadius.circular(4),
14-
color: Theme.of(context).primaryColor.withOpacity(.06),
14+
color: Theme.of(context).primaryColor.withValues(alpha: .06),
1515
),
1616
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
1717
child: Center(

lib/core/entity/entities_base.dart

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ const entityTypeTranslations = <EntityType, String>{
4343
};
4444

4545
typedef EntityTapFunction<T> = Function(T entity);
46-
typedef EntityCardWidgetBuilder<T> = Widget Function(
47-
BuildContext context,
48-
T entity,
49-
);
46+
typedef EntityCardWidgetBuilder<T> =
47+
Widget Function(BuildContext context, T entity);
5048

5149
class EntityCardSettings {
5250
EntityCardSettings({this.dropShadow = true});
@@ -111,7 +109,7 @@ mixin ContactBasedBase<T extends ContactBased, P> on EntitiesBase<T, P> {
111109
maxLines: 2,
112110
overflow: TextOverflow.ellipsis,
113111
style: TbTextStyles.labelLarge.copyWith(
114-
color: Colors.black.withOpacity(.87),
112+
color: Colors.black.withValues(alpha: .87),
115113
),
116114
),
117115
),
@@ -123,7 +121,7 @@ mixin ContactBasedBase<T extends ContactBased, P> on EntitiesBase<T, P> {
123121
),
124122
),
125123
style: TbTextStyles.bodyMedium.copyWith(
126-
color: Colors.black.withOpacity(.54),
124+
color: Colors.black.withValues(alpha: .54),
127125
),
128126
),
129127
],
@@ -176,17 +174,14 @@ class PageKeyValue<P> {
176174

177175
class PageLinkController extends PageKeyController<PageLink> {
178176
PageLinkController({int pageSize = 20, String? searchText})
179-
: super(
180-
PageLink(
181-
pageSize,
182-
0,
183-
searchText,
184-
SortOrder(
185-
'createdTime',
186-
Direction.DESC,
187-
),
188-
),
189-
);
177+
: super(
178+
PageLink(
179+
pageSize,
180+
0,
181+
searchText,
182+
SortOrder('createdTime', Direction.DESC),
183+
),
184+
);
190185

191186
@override
192187
PageLink nextPageKey(PageLink pageKey) => pageKey.nextPageLink();
@@ -200,14 +195,14 @@ class PageLinkController extends PageKeyController<PageLink> {
200195

201196
class TimePageLinkController extends PageKeyController<TimePageLink> {
202197
TimePageLinkController({int pageSize = 20, String? searchText})
203-
: super(
204-
TimePageLink(
205-
pageSize,
206-
0,
207-
searchText,
208-
SortOrder('createdTime', Direction.DESC),
209-
),
210-
);
198+
: super(
199+
TimePageLink(
200+
pageSize,
201+
0,
202+
searchText,
203+
SortOrder('createdTime', Direction.DESC),
204+
),
205+
);
211206

212207
@override
213208
TimePageLink nextPageKey(TimePageLink pageKey) => pageKey.nextPageLink();
@@ -231,16 +226,17 @@ abstract class BaseEntitiesWidget<T, P> extends TbContextWidget
231226
final PageKeyController<P> pageKeyController;
232227

233228
@override
234-
Widget? buildHeading(BuildContext context) => searchMode
235-
? const Text(
236-
'Search results',
237-
style: TextStyle(
238-
color: Color(0xFFAFAFAF),
239-
fontSize: 16,
240-
height: 24 / 16,
241-
),
242-
)
243-
: null;
229+
Widget? buildHeading(BuildContext context) =>
230+
searchMode
231+
? const Text(
232+
'Search results',
233+
style: TextStyle(
234+
color: Color(0xFFAFAFAF),
235+
fontSize: 16,
236+
height: 24 / 16,
237+
),
238+
)
239+
: null;
244240
}
245241

246242
abstract class BaseEntitiesState<T, P>
@@ -256,8 +252,9 @@ abstract class BaseEntitiesState<T, P>
256252
@override
257253
void initState() {
258254
super.initState();
259-
pagingController =
260-
PagingController(firstPageKey: widget.pageKeyController.value.pageKey);
255+
pagingController = PagingController(
256+
firstPageKey: widget.pageKeyController.value.pageKey,
257+
);
261258
widget.pageKeyController.addListener(_didChangePageKeyValue);
262259
pagingController.addPageRequestListener((pageKey) {
263260
_fetchPage(pageKey);
@@ -363,9 +360,7 @@ abstract class BaseEntitiesState<T, P>
363360
right: 0,
364361
child: Row(
365362
mainAxisAlignment: MainAxisAlignment.center,
366-
children: [
367-
RefreshProgressIndicator(),
368-
],
363+
children: [RefreshProgressIndicator()],
369364
),
370365
),
371366
],
@@ -374,13 +369,8 @@ abstract class BaseEntitiesState<T, P>
374369

375370
Widget newPageProgressIndicatorBuilder(BuildContext context) {
376371
return const Padding(
377-
padding: EdgeInsets.only(
378-
top: 16,
379-
bottom: 16,
380-
),
381-
child: Center(
382-
child: RefreshProgressIndicator(),
383-
),
372+
padding: EdgeInsets.only(top: 16, bottom: 16),
373+
child: Center(child: RefreshProgressIndicator()),
384374
);
385375
}
386376

lib/modules/alarm/alarms_base.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ final alarmSeverityColors = <AlarmSeverity, Color>{
66
AlarmSeverity.MAJOR: const Color(0xFFF66716),
77
AlarmSeverity.MINOR: const Color(0xFFF2DA05),
88
AlarmSeverity.WARNING: const Color(0xFFFAA405),
9-
AlarmSeverity.INDETERMINATE: Colors.black.withOpacity(0.38),
9+
AlarmSeverity.INDETERMINATE: Colors.black.withValues(alpha: 0.38),
1010
};
1111

1212
const alarmSeverityTranslations = <AlarmSeverity, String>{

lib/modules/alarm/presentation/view/alarm_details_page.dart

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ import 'package:thingsboard_app/widgets/tb_app_bar.dart';
1717
import 'package:thingsboard_app/widgets/tb_progress_indicator.dart';
1818

1919
class AlarmDetailsPage extends TbContextWidget {
20-
AlarmDetailsPage(
21-
super.tbContext, {
22-
required this.id,
23-
super.key,
24-
});
20+
AlarmDetailsPage(super.tbContext, {required this.id, super.key});
2521

2622
final String id;
2723

@@ -35,14 +31,16 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
3531
return MultiBlocProvider(
3632
providers: [
3733
BlocProvider<AlarmDetailsBloc>(
38-
create: (_) => AlarmDetailsBloc.create()
39-
..add(AlarmDetailsFetchEvent(id: widget.id)),
34+
create:
35+
(_) =>
36+
AlarmDetailsBloc.create()
37+
..add(AlarmDetailsFetchEvent(id: widget.id)),
4038
),
4139
BlocProvider<AlarmAssigneeBloc>(
42-
create: (_) => AlarmAssigneeBloc.create(id: widget.id)
43-
..add(
44-
const AlarmFetchAssigneeEvent(),
45-
),
40+
create:
41+
(_) =>
42+
AlarmAssigneeBloc.create(id: widget.id)
43+
..add(const AlarmFetchAssigneeEvent()),
4644
),
4745
],
4846
child: BlocBuilder<AlarmDetailsBloc, AlarmDetailsState>(
@@ -53,9 +51,7 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
5351
body: SizedBox.expand(
5452
child: ColoredBox(
5553
color: Color(0x99FFFFFF),
56-
child: Center(
57-
child: TbProgressIndicator(size: 50.0),
58-
),
54+
child: Center(child: TbProgressIndicator(size: 50.0)),
5955
),
6056
),
6157
);
@@ -67,7 +63,7 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
6763
title: Text(
6864
state.alarmInfo.type,
6965
style: TbTextStyles.titleXs.copyWith(
70-
color: Colors.black.withOpacity(.87),
66+
color: Colors.black.withValues(alpha: .87),
7167
),
7268
),
7369
),
@@ -86,9 +82,9 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
8682
children: [
8783
AlarmDetailsWidget(
8884
alarmInfo: state.alarmInfo,
89-
alamDashboardId: state
90-
.alarmInfo.details?['dashboardId']
91-
?.toString(),
85+
alamDashboardId:
86+
state.alarmInfo.details?['dashboardId']
87+
?.toString(),
9288
tbContext: tbContext,
9389
),
9490
Padding(
@@ -121,7 +117,7 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
121117
title: Text(
122118
S.of(context).failedToLoadAlarmDetails,
123119
style: TbTextStyles.titleXs.copyWith(
124-
color: Colors.black.withOpacity(.87),
120+
color: Colors.black.withValues(alpha: .87),
125121
),
126122
),
127123
),
@@ -140,10 +136,7 @@ class _AlarmDetailsPageState extends TbContextState<AlarmDetailsPage> {
140136

141137
@override
142138
void initState() {
143-
AlarmDetailsDi.init(
144-
widget.tbClient,
145-
id: AlarmId(widget.id),
146-
);
139+
AlarmDetailsDi.init(widget.tbClient, id: AlarmId(widget.id));
147140
super.initState();
148141
}
149142

0 commit comments

Comments
 (0)