Skip to content

Commit

Permalink
replace fms with material_symbols_icons package
Browse files Browse the repository at this point in the history
this resolves problem with them not being centered, and some dependency conflicts
  • Loading branch information
TheLastGimbus committed Sep 20, 2023
1 parent b70e68e commit 5bbb4ed
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 162 deletions.
26 changes: 0 additions & 26 deletions assets/fms_config.yml

This file was deleted.

Binary file removed assets/fonts/fms.ttf
Binary file not shown.
39 changes: 0 additions & 39 deletions lib/gen/fms.dart

This file was deleted.

21 changes: 7 additions & 14 deletions lib/ui/pages/home/controls/anc_card.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:material_symbols_icons/symbols.dart';

import '../../../../gen/fms.dart';
import '../../../../headphones/headphones_base.dart';
import '../../../../headphones/headphones_data_objects.dart';
import '../../../common/constrained_spacer.dart';
Expand All @@ -26,25 +26,22 @@ class AncCard extends StatelessWidget {
const ConstrainedSpacer(
constraints: BoxConstraints(maxWidth: 32)),
_AncButton(
icon: Fms.noise_control_on,
iconSelected: Fms.noise_control_on_700,
icon: Symbols.noise_control_on,
isSelected: mode == HeadphonesAncMode.noiseCancel,
onPressed: () =>
headphones.setAncMode(HeadphonesAncMode.noiseCancel),
),
const ConstrainedSpacer(
constraints: BoxConstraints(maxWidth: 32)),
_AncButton(
icon: Fms.noise_control_off,
iconSelected: Fms.noise_control_off_700,
icon: Symbols.noise_control_off,
isSelected: mode == HeadphonesAncMode.off,
onPressed: () => headphones.setAncMode(HeadphonesAncMode.off),
),
const ConstrainedSpacer(
constraints: BoxConstraints(maxWidth: 32)),
_AncButton(
icon: Fms.noise_aware,
iconSelected: Fms.noise_aware_700,
icon: Symbols.noise_aware,
isSelected: mode == HeadphonesAncMode.awareness,
onPressed: () =>
headphones.setAncMode(HeadphonesAncMode.awareness),
Expand All @@ -65,27 +62,23 @@ class AncCard extends StatelessWidget {
/// TODO: Make this prettier (splash animation at least :/ )
class _AncButton extends StatelessWidget {
final IconData icon;

/// If non-null, this will be used when button is selected
final IconData? iconSelected;
final bool isSelected;
final VoidCallback? onPressed;

const _AncButton({
Key? key,
required this.icon,
this.iconSelected,
required this.isSelected,
this.onPressed,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final child = Padding(
// shit: google material symbols are not centered :/
padding: const EdgeInsets.fromLTRB(0, 2, 0, 6),
padding: const EdgeInsets.all(2),
child: Icon(
(isSelected && iconSelected != null) ? iconSelected : icon,
icon,
weight: isSelected ? 600 : 400,
size: 42,
),
);
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/pages/home/controls/battery_card.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:material_color_utilities/material_color_utilities.dart';
import 'package:material_symbols_icons/symbols.dart';

import '../../../../gen/fms.dart';
import '../../../../headphones/headphones_base.dart';

/// Android12-Google-Battery-Widget-style battery card
Expand Down Expand Up @@ -33,7 +33,8 @@ class BatteryCard extends StatelessWidget {
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 1),
child: Icon(
Fms.charger_filled,
Symbols.charger,
fill: 1,
size: 20,
color: t.colorScheme.onPrimaryContainer,
),
Expand Down
84 changes: 14 additions & 70 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ packages:
dependency: transitive
description:
name: cli_util
sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c"
sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7
url: "https://pub.dev"
source: hosted
version: "0.3.5"
version: "0.4.0"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -170,10 +170,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_launcher_icons
sha256: "02dcaf49d405f652b7160e882bacfc02cb497041bb2eab2a49b1c393cf9aac12"
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.12.0"
version: "0.13.1"
flutter_lints:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -205,22 +205,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fms:
dependency: "direct dev"
description:
name: fms
sha256: "9349827c43b9058f6339c0a90c6025c501750c1e6bdec73215a3d1c21c875eac"
url: "https://pub.dev"
source: hosted
version: "0.9.2"
fpdart:
dependency: transitive
description:
name: fpdart
sha256: "40dfb6f837ed1a24bc379083b564c196e6d771d713c9641cc30402a1fb989926"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
home_widget:
dependency: "direct main"
description:
Expand All @@ -237,30 +221,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.15.4"
http:
dependency: transitive
description:
name: http
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
url: "https://pub.dev"
source: hosted
version: "0.13.6"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
icon_font_generator:
dependency: transitive
description:
name: icon_font_generator
sha256: "100a4f5093f10cd83ae5ee3f1ca862c90f536436136dadc2bbc2a96aa391a08e"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
image:
dependency: transitive
description:
Expand All @@ -269,14 +229,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.17"
internet_file:
dependency: transitive
description:
name: internet_file
sha256: c3e6aa0c1cc6c08e701bb91019a7784fece1f64e18464f53df1200caa7598b68
url: "https://pub.dev"
source: hosted
version: "1.2.0"
intl:
dependency: "direct main"
description:
Expand Down Expand Up @@ -333,6 +285,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.8.0"
material_symbols_icons:
dependency: "direct main"
description:
name: material_symbols_icons
sha256: "8b0b7c1103986ec2f1252f4f5013d61d44f02add3140f064fdeb8b661560aff0"
url: "https://pub.dev"
source: hosted
version: "4.2668.0"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -417,10 +377,10 @@ packages:
dependency: transitive
description:
name: permission_handler_android
sha256: f23cfe9af0d49c6b9fd8a8b09f7b3301ca7e346204939b5afef4404d36d2608f
sha256: "740c9c9d3090a29cd2fd1f193bba457ac1d2cef1da0ef91f2630d3d9e3c01c15"
url: "https://pub.dev"
source: hosted
version: "11.0.1"
version: "11.0.2"
permission_handler_apple:
dependency: transitive
description:
Expand Down Expand Up @@ -485,14 +445,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.5"
recase:
dependency: transitive
description:
name: recase
sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213
url: "https://pub.dev"
source: hosted
version: "4.1.0"
rxdart:
dependency: "direct main"
description:
Expand Down Expand Up @@ -651,14 +603,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_file:
dependency: transitive
description:
name: universal_file
sha256: d1a957fccaad2a32023b62fe435b273ee47aaf2eb804709795e4bf4afff50960
url: "https://pub.dev"
source: hosted
version: "1.0.0"
universal_io:
dependency: transitive
description:
Expand Down
15 changes: 4 additions & 11 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dependencies:
## This is low-level, but I *do* use it to mix colors here and there
material_color_utilities: ^0.8.0
screenshot: ^2.1.0
material_symbols_icons: ^4.2668.0

dependency_overrides:
## flutter_test, as always...
Expand All @@ -72,18 +73,15 @@ dev_dependencies:
flutter_test:
sdk: flutter

## When updating stuff here, it conflicts with fms
## TODO: Replace fms: https://github.com/fujidaiti/fms/issues/3
flutter_launcher_icons: ^0.12.0
flutter_native_splash: ^2.3.1
fms: ^0.9.2
flutter_launcher_icons: ^0.13.1
flutter_native_splash: ^2.3.2

flutter_lints: ^2.0.3


# Run with:
# $ flutter pub run flutter_launcher_icons:main
flutter_icons:
flutter_launcher_icons:
# This was made using:
# $ convert ic_launcher.png -gravity Center -background transparent -extent 352x352 ic_launcher_adaptive_fore.png
image_path: "assets/app_icons/ic_launcher.png"
Expand Down Expand Up @@ -118,10 +116,5 @@ flutter:
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

fonts:
- family: Fms
fonts:
- asset: assets/fonts/fms.ttf

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

0 comments on commit 5bbb4ed

Please sign in to comment.