Skip to content

Commit

Permalink
Migrate to TextScaler
Browse files Browse the repository at this point in the history
  • Loading branch information
mono0926 committed Nov 17, 2023
1 parent 6fd98f5 commit 04a22be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
mono_kit: 67c15c1486e232d7f44ac47286933e80aa02f7a3
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
12 changes: 2 additions & 10 deletions lib/src/modal_action_sheet/cupertino_modal_action_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:math';

import 'package:adaptive_dialog/src/action_callback.dart';
import 'package:adaptive_dialog/src/extensions/extensions.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -29,19 +27,13 @@ class CupertinoModalActionSheet<T> extends StatelessWidget {

@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final title = this.title;
final message = this.message;
return PopScope(
canPop: canPop,
onPopInvoked: onPopInvoked,
child: MediaQuery(
data: mediaQuery.copyWith(
// `CupertinoAlertDialog` overrides textScaleFactor
// to keep larger than 1, but `CupertinoActionSheet` doesn't.
// https://twitter.com/_mono/status/1266997626693509126
textScaler: TextScaler.linear(max(1, mediaQuery.textScaleFactor)),
),
child: MediaQuery.withClampedTextScaling(
minScaleFactor: 1,
child: CupertinoActionSheet(
title: title == null ? null : Text(title),
message: message == null ? null : Text(message),
Expand Down

0 comments on commit 04a22be

Please sign in to comment.