Skip to content

Commit

Permalink
Fix flutter beta deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Sep 11, 2024
1 parent d131595 commit 7f3e2a3
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 130 deletions.
2 changes: 1 addition & 1 deletion app/lib/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final appRouter = Provider<AppRouter>((ref) => AppRouter(ref: ref.passing));
@AutoRouterConfig(
replaceInRouteName: "Page,Route",
)
class AppRouter extends _$AppRouter {
class AppRouter extends RootStackRouter {
AppRouter({
required this.ref,
});
Expand Down
150 changes: 66 additions & 84 deletions app/lib/app_router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class TypeWriterApp extends HookConsumerWidget {
borderSide: BorderSide.none,
),
fillColor: brightness == Brightness.light
? Colors.black.withOpacity(0.05)
: Colors.black.withOpacity(0.2),
? Colors.black.withValues(alpha: 0.05)
: Colors.black.withValues(alpha: 0.2),
filled: true,
hoverColor: Colors.black.withOpacity(0.1),
hoverColor: Colors.black.withValues(alpha: 0.1),
errorStyle: const TextStyle(
color: Colors.redAccent,
fontSize: 12,
Expand All @@ -88,7 +88,7 @@ class TypeWriterApp extends HookConsumerWidget {
borderSide: const BorderSide(color: Colors.red, width: 2),
),
),
hoverColor: Colors.black.withOpacity(0.1),
hoverColor: Colors.black.withValues(alpha: 0.1),
colorScheme: baseTheme.colorScheme.copyWith(
primary: Colors.blueAccent,
brightness: brightness,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/book_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class _RailButton extends HookConsumerWidget {
final tabRouter = context.tabsRouter;
final isSelected = tabRouter.activeIndex == index;
return Material(
color: isSelected ? Colors.white.withOpacity(0.15) : Colors.transparent,
color: isSelected ? Colors.white.withValues(alpha:0.15) : Colors.transparent,
borderRadius: BorderRadius.circular(8),
child: InkWell(
onTap: () => tabRouter.setActiveIndex(index),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/pages_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class _TreeCategory extends HookConsumerWidget {
width: 6,
margin: EdgeInsets.only(left: showFull ? 14 : 10),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.2),
color: Colors.black.withValues(alpha:0.2),
borderRadius: BorderRadius.circular(2),
),
),
Expand Down
1 change: 1 addition & 0 deletions app/lib/utils/color_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class NullableColorConverter extends JsonConverter<Color?, String?> {
String? toJson(Color? object) {
if (object == null) return null;

// ignore: deprecated_member_use
final hex = object.value.toRadixString(16).padLeft(8, "0");
return "#$hex";
}
Expand Down
14 changes: 7 additions & 7 deletions app/lib/widgets/components/app/cinematic_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ class _BackgroundLinePainter extends CustomPainter {
..strokeWidth = 1;

final secondaryPaint = Paint()
..color = Colors.grey.shade700.withOpacity(0.5)
..color = Colors.grey.shade700.withValues(alpha:0.5)
..strokeWidth = 1;

for (final line in lines) {
Expand Down Expand Up @@ -1298,7 +1298,7 @@ class _SegmentDurationDisplay extends HookConsumerWidget {
"Total Duration: $secondsWithDecimal seconds ($totalTime frames)",
style: Theme.of(context).textTheme.bodySmall?.apply(
color:
Theme.of(context).textTheme.bodySmall?.color?.withOpacity(0.8),
Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha:0.8),
fontStyle: FontStyle.italic,
),
);
Expand Down Expand Up @@ -1487,8 +1487,8 @@ class _SegmentSelectorTile extends HookConsumerWidget {
segment.icon,
size: 16,
color: color.computeLuminance() > 0.5
? Colors.black.withOpacity(0.6)
: Colors.white.withOpacity(0.6),
? Colors.black.withValues(alpha:0.6)
: Colors.white.withValues(alpha:0.6),
),
const SizedBox(width: 8),
Text(
Expand All @@ -1505,8 +1505,8 @@ class _SegmentSelectorTile extends HookConsumerWidget {
TWIcons.angleRight,
size: 12,
color: color.computeLuminance() > 0.5
? Colors.black.withOpacity(0.5)
: Colors.white.withOpacity(0.5),
? Colors.black.withValues(alpha:0.5)
: Colors.white.withValues(alpha:0.5),
),
],
),
Expand Down Expand Up @@ -1608,7 +1608,7 @@ class _SegmentWidget extends HookConsumerWidget {
? Border.all(
color: context.isDark
? Colors.white
: Colors.black.withOpacity(0.4),
: Colors.black.withValues(alpha:0.4),
width: 2,
)
: Border.all(color: Colors.transparent, width: 2),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/widgets/components/app/entry_node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ class ExternalEntryNode extends HookConsumerWidget {
color: Theme.of(context).scaffoldBackgroundColor,
child: Material(
animationDuration: 300.ms,
color: blueprint.color.withOpacity(0.6),
color: blueprint.color.withValues(alpha:0.6),
shape: RoundedRectangleBorder(
side: BorderSide(color: blueprint.color, width: 3),
borderRadius: BorderRadius.circular(4),
Expand Down Expand Up @@ -730,7 +730,7 @@ class ExternalEntryNode extends HookConsumerWidget {
Text(
pageName,
style: TextStyle(
color: color.withOpacity(0.7),
color: color.withValues(alpha:0.7),
fontSize: 11,
),
),
Expand Down
18 changes: 10 additions & 8 deletions app/lib/widgets/components/app/search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class _Barrier extends HookConsumerWidget {
return Positioned.fill(
child: ModalBarrier(
dismissible: true,
color: Colors.black.withOpacity(0.5),
color: Colors.black.withValues(alpha: 0.5),
onDismiss: () {
ref.read(searchProvider.notifier).endSearch();
},
Expand Down Expand Up @@ -587,7 +587,7 @@ class _FetcherChip extends HookConsumerWidget {
return Material(
color: switch (status) {
FetchStatus.fetching => fetcher.color,
FetchStatus.quantifierBlocked => fetcher.color.withOpacity(0.3),
FetchStatus.quantifierBlocked => fetcher.color.withValues(alpha: 0.3),
FetchStatus.disabled => Theme.of(context).cardColor,
},
borderRadius: BorderRadius.circular(30),
Expand All @@ -612,7 +612,7 @@ class _FetcherChip extends HookConsumerWidget {
fetcher.icon,
color: status != FetchStatus.quantifierBlocked
? Colors.white
: Colors.white.withOpacity(0.3),
: Colors.white.withValues(alpha: 0.3),
size: 16,
),
const SizedBox(width: 8),
Expand All @@ -621,7 +621,7 @@ class _FetcherChip extends HookConsumerWidget {
style: TextStyle(
color: status != FetchStatus.quantifierBlocked
? Colors.white
: Colors.white.withOpacity(0.3),
: Colors.white.withValues(alpha: 0.3),
),
),
],
Expand Down Expand Up @@ -694,8 +694,9 @@ class _ResultTile extends HookConsumerWidget {
curve: Curves.fastLinearToSlowEaseIn,
height: 56.0,
width: 400,
color:
focused.value ? color.withOpacity(0.6) : Colors.transparent,
color: focused.value
? color.withValues(alpha: 0.6)
: Colors.transparent,
child: Focus(
focusNode: focusNode,
autofocus: true,
Expand All @@ -711,8 +712,9 @@ class _ResultTile extends HookConsumerWidget {
children: [
Container(
height: double.infinity,
color:
color.withOpacity(color.opacity.clamp(0, 0.8)),
color: color.withValues(
alpha: color.a.clamp(0, 0.8),
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0),
Expand Down
1 change: 1 addition & 0 deletions app/lib/widgets/components/app/writers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class WriterIcon extends HookWidget {
Widget _icon(Color color) {
if (writer.iconUrl == null) {
// We want to remove the opacity from the color which is the first two characters
// ignore: deprecated_member_use
final colorValue = color.value & 0xFFFFFF;
final url =
"https://api.dicebear.com/8.x/adventurer-neutral/svg?backgroundColor=${colorValue.toRadixString(16)}&seed=${writer.id}";
Expand Down
Loading

0 comments on commit 7f3e2a3

Please sign in to comment.