about: removed license sort menu
This commit is contained in:
parent
c080de2f9a
commit
0227325781
3 changed files with 16 additions and 62 deletions
|
@ -290,12 +290,6 @@
|
|||
"@aboutLicenses": {},
|
||||
"aboutLicensesBanner": "This app uses the following open-source packages and libraries.",
|
||||
"@aboutLicensesBanner": {},
|
||||
"aboutLicensesSortTooltip": "Sort",
|
||||
"@aboutLicensesSortTooltip": {},
|
||||
"aboutLicensesSortByName": "Sort by name",
|
||||
"@aboutLicensesSortByName": {},
|
||||
"aboutLicensesSortByLicense": "Sort by license",
|
||||
"@aboutLicensesSortByLicense": {},
|
||||
"aboutLicensesAndroidLibraries": "Android Libraries",
|
||||
"@aboutLicensesAndroidLibraries": {},
|
||||
"aboutLicensesFlutterPlugins": "Flutter Plugins",
|
||||
|
|
|
@ -132,9 +132,6 @@
|
|||
"aboutCreditsWorldAtlas2": "의 TopoJSON 파일(ISC 라이선스)을 이용합니다.",
|
||||
"aboutLicenses": "오픈 소스 라이선스",
|
||||
"aboutLicensesBanner": "이 앱은 다음의 오픈 소스 패키지와 라이브러리를 이용합니다.",
|
||||
"aboutLicensesSortTooltip": "정렬",
|
||||
"aboutLicensesSortByName": "이름순 정렬",
|
||||
"aboutLicensesSortByLicense": "라이선스순 정렬",
|
||||
"aboutLicensesAndroidLibraries": "안드로이드 라이브러리",
|
||||
"aboutLicensesFlutterPlugins": "플러터 플러그인",
|
||||
"aboutLicensesFlutterPackages": "플러터 패키지",
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import 'package:aves/ref/brand_colors.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/utils/constants.dart';
|
||||
import 'package:aves/widgets/common/basic/link_chip.dart';
|
||||
import 'package:aves/widgets/common/basic/menu_row.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
@ -15,7 +13,6 @@ class Licenses extends StatefulWidget {
|
|||
|
||||
class _LicensesState extends State<Licenses> {
|
||||
final ValueNotifier<String> _expandedNotifier = ValueNotifier(null);
|
||||
LicenseSort _sort = LicenseSort.name;
|
||||
List<Dependency> _platform, _flutterPlugins, _flutterPackages, _dartPackages;
|
||||
|
||||
@override
|
||||
|
@ -29,17 +26,7 @@ class _LicensesState extends State<Licenses> {
|
|||
}
|
||||
|
||||
void _sortPackages() {
|
||||
int compare(Dependency a, Dependency b) {
|
||||
switch (_sort) {
|
||||
case LicenseSort.license:
|
||||
final c = compareAsciiUpperCase(a.license, b.license);
|
||||
return c != 0 ? c : compareAsciiUpperCase(a.name, b.name);
|
||||
case LicenseSort.name:
|
||||
default:
|
||||
return compareAsciiUpperCase(a.name, b.name);
|
||||
}
|
||||
}
|
||||
|
||||
int compare(Dependency a, Dependency b) => compareAsciiUpperCase(a.name, b.name);
|
||||
_platform.sort(compare);
|
||||
_flutterPlugins.sort(compare);
|
||||
_flutterPackages.sort(compare);
|
||||
|
@ -103,44 +90,22 @@ class _LicensesState extends State<Licenses> {
|
|||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.only(start: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(context.l10n.aboutLicenses, style: Constants.titleTextStyle),
|
||||
),
|
||||
PopupMenuButton<LicenseSort>(
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: LicenseSort.name,
|
||||
child: MenuRow(text: context.l10n.aboutLicensesSortByName, checked: _sort == LicenseSort.name),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: LicenseSort.license,
|
||||
child: MenuRow(text: context.l10n.aboutLicensesSortByLicense, checked: _sort == LicenseSort.license),
|
||||
),
|
||||
],
|
||||
onSelected: (newSort) {
|
||||
_sort = newSort;
|
||||
_sortPackages();
|
||||
setState(() {});
|
||||
},
|
||||
tooltip: context.l10n.aboutLicensesSortTooltip,
|
||||
icon: Icon(AIcons.sort),
|
||||
),
|
||||
],
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(minHeight: 48),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(context.l10n.aboutLicenses, style: Constants.titleTextStyle),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(context.l10n.aboutLicensesBanner),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8),
|
||||
Text(context.l10n.aboutLicensesBanner),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -179,5 +144,3 @@ class LicenseRow extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum LicenseSort { license, name }
|
||||
|
|
Loading…
Reference in a new issue