chore(deps): upgrade Flutter SDK from 3.10.1 to 3.27.1

- Update Flutter SDK version to 3.27.1
- Update minimum dart SDK version
- Update dependencies to compatible versions
- Fix deprecated method calls
- Run migration for breaking changes
This commit is contained in:
anhtunz
2025-01-05 18:48:11 +07:00
parent 178a00f5ba
commit fb12c44505
30 changed files with 266 additions and 212 deletions

View File

@@ -335,8 +335,8 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
);
},
style: const ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.red),
foregroundColor: MaterialStatePropertyAll(Colors.white),
backgroundColor: WidgetStatePropertyAll(Colors.red),
foregroundColor: WidgetStatePropertyAll(Colors.white),
),
child: Text(
appLocalization(context).delete_group_title,
@@ -383,7 +383,8 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
child: Text(
appLocalization(context)
.confirm_button_content,
style: const TextStyle(color: Colors.red),
style: const TextStyle(
color: Colors.red),
))
],
);
@@ -391,8 +392,8 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
});
},
style: const ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.red),
foregroundColor: MaterialStatePropertyAll(Colors.white),
backgroundColor: WidgetStatePropertyAll(Colors.red),
foregroundColor: WidgetStatePropertyAll(Colors.white),
),
child: Text(
appLocalization(context).leave_group_title,
@@ -437,16 +438,19 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
itemCount: devices.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text(devices[index].alias != ""
? devices[index].alias!
: devices[index].name!,),
title: Text(
devices[index].alias != ""
? devices[index].alias!
: devices[index].name!,
),
trailing: Text(
DeviceUtils.instance.checkStateDevice(
context, devices[index].state!),
style: TextStyle(
color: DeviceUtils.instance
.getTableRowColor(
devices[index].state!,),),
color: DeviceUtils.instance.getTableRowColor(
devices[index].state!,
),
),
),
);
},
@@ -454,7 +458,8 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
),
],
);
},),
},
),
),
);
}
@@ -500,8 +505,8 @@ class _DetailGroupScreenState extends State<DetailGroupScreen> {
Center(
child: TextButton(
style: const ButtonStyle(
foregroundColor: MaterialStatePropertyAll(Colors.white),
backgroundColor: MaterialStatePropertyAll(Colors.green)),
foregroundColor: WidgetStatePropertyAll(Colors.white),
backgroundColor: WidgetStatePropertyAll(Colors.green)),
onPressed: () async {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
String alias = aliasController.text;

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -36,74 +38,75 @@ class _GroupsScreenState extends State<GroupsScreen> {
widget.role == ApplicationConstants.PARTICIPANT_GROUP) {
interFamilyBloc.getAllGroup(widget.role);
return StreamBuilder<List<Group>>(
stream: interFamilyBloc.streamCurrentGroups,
builder: (context, groupsSnapshot) {
return Scaffold(
body: groupsSnapshot.data?.isEmpty ?? true
? const Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
itemCount: groupsSnapshot.data!.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
context.pushNamed(AppRoutes.GROUP_DETAIL.name,
pathParameters: {
"groupId": groupsSnapshot.data![index].id!
},
extra: widget.role);
},
leading: IconConstants.instance
.getMaterialIcon(Icons.diversity_2),
title: Text(
groupsSnapshot.data![index].name ?? '',
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(
groupsSnapshot.data![index].description ?? ""),
trailing:
widget.role == ApplicationConstants.OWNER_GROUP
? PopupMenuButton(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0),
topLeft: Radius.circular(8.0),
topRight: Radius.circular(8.0),
),
stream: interFamilyBloc.streamCurrentGroups,
builder: (context, groupsSnapshot) {
return Scaffold(
body: groupsSnapshot.data?.isEmpty ?? true
? const Center(
child: CircularProgressIndicator(),
)
: ListView.builder(
itemCount: groupsSnapshot.data!.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
context.pushNamed(AppRoutes.GROUP_DETAIL.name,
pathParameters: {
"groupId": groupsSnapshot.data![index].id!
},
extra: widget.role);
},
leading: IconConstants.instance
.getMaterialIcon(Icons.diversity_2),
title: Text(
groupsSnapshot.data![index].name ?? '',
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle:
Text(groupsSnapshot.data![index].description ?? ""),
trailing:
widget.role == ApplicationConstants.OWNER_GROUP
? PopupMenuButton(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0),
topLeft: Radius.circular(8.0),
topRight: Radius.circular(8.0),
),
itemBuilder: (ctx) => [
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.share_group_title,
Icons.share,
4),
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.change_group_infomation_title,
Icons.settings_backup_restore,
2),
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.delete_group_title,
Icons.delete_forever_rounded,
3),
],
icon: const Icon(Icons.more_horiz),
)
: const SizedBox.shrink(),
);
},
),
);
});
),
itemBuilder: (ctx) => [
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.share_group_title,
Icons.share,
4),
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.change_group_infomation_title,
Icons.settings_backup_restore,
2),
_buildPopupMenuItem(
groupsSnapshot.data![index],
context,
appLocalization(context)
.delete_group_title,
Icons.delete_forever_rounded,
3),
],
icon: const Icon(Icons.more_horiz),
)
: const SizedBox.shrink(),
);
},
),
);
},
);
} else {
return const SizedBox.shrink();
}

View File

@@ -9,7 +9,7 @@ import 'groups_model.dart';
shareGroup(BuildContext context, Group group) {
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
barrierColor: Colors.black.withValues(alpha: 0.5),
transitionBuilder: (context, a1, a2, widget) {
return Material(
child: Scaffold(