Skip to content

Commit

Permalink
feat: bump min flutter version to 3.16.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sahil Kumar <[email protected]>
  • Loading branch information
xsahil03x committed Mar 11, 2024
1 parent 0af0a99 commit 86dd84c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/giffy_dialog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.10.0
channel: stable
cache: true

Expand Down Expand Up @@ -63,7 +62,6 @@ jobs:
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.10.0
channel: stable
cache: true

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Upcoming

- Bump minimum Flutter version to 3.16.0.

## 2.0.0+2

- Fix README.md gif links.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/entry_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ extension on EntryAnimation {
class EntryAnimatedContainer extends StatefulWidget {
/// Creates a [EntryAnimatedContainer].
const EntryAnimatedContainer({
Key? key,
super.key,
this.animation = EntryAnimation.none,
required this.child,
}) : super(key: key);
});

/// Defines the entry animation.
///
Expand Down
11 changes: 7 additions & 4 deletions lib/src/giffy_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,12 @@ class GiffyModal extends StatelessWidget {

// The paddingScaleFactor is used to adjust the padding of modal's
// children.
final paddingScaleFactor =
_paddingScaleFactor(MediaQuery.of(context).textScaleFactor);
final textDirection = Directionality.maybeOf(context);
const double fontSizeToScale = 14.0;
final double effectiveTextScale =
MediaQuery.textScalerOf(context).scale(fontSizeToScale) /
fontSizeToScale;
final double paddingScaleFactor = _scalePadding(effectiveTextScale);
final TextDirection? textDirection = Directionality.maybeOf(context);

final bool belowIsTitle = title != null;
final bool belowIsContent = !belowIsTitle && content != null;
Expand Down Expand Up @@ -486,7 +489,7 @@ class GiffyModal extends StatelessWidget {
}
}

double _paddingScaleFactor(double textScaleFactor) {
double _scalePadding(double textScaleFactor) {
final double clampedTextScaleFactor = clampDouble(textScaleFactor, 1.0, 2.0);
// The final padding scale factor is clamped between 1/3 and 1. For example,
// a non-scaled padding of 24 will produce a padding between 24 and 8.
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/xsahil03x/giffy_dialog
issue_tracker: https://github.com/xsahil03x/giffy_dialog/issues

environment:
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"
sdk: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

dependencies:
flutter:
Expand Down
17 changes: 11 additions & 6 deletions test/giffy_dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ MaterialApp _buildAppWithDialog(
showDialog<void>(
context: context,
builder: (BuildContext context) {
return MediaQuery(
data: MediaQuery.of(context)
.copyWith(textScaleFactor: textScaleFactor),
return MediaQuery.withClampedTextScaling(
minScaleFactor: textScaleFactor,
maxScaleFactor: textScaleFactor,
child: dialog,
);
},
Expand Down Expand Up @@ -241,17 +241,21 @@ void main() {
});

testWidgets('Null giffyDialog shape', (WidgetTester tester) async {
final ThemeData theme = ThemeData();
const GiffyDialog dialog = GiffyDialog(
giffy: Icon(Icons.ac_unit),
actions: <Widget>[],
);
await tester.pumpWidget(_buildAppWithDialog(dialog));
await tester.pumpWidget(_buildAppWithDialog(dialog, theme: theme));

await tester.tap(find.text('X'));
await tester.pumpAndSettle();

final Material materialWidget = _getMaterialFromDialog(tester);
expect(materialWidget.shape, _defaultM2DialogShape);
expect(
materialWidget.shape,
theme.useMaterial3 ? _defaultM3DialogShape : _defaultM2DialogShape,
);
});

testWidgets('Rectangular giffyDialog shape', (WidgetTester tester) async {
Expand Down Expand Up @@ -493,7 +497,7 @@ void main() {
);

await tester.pumpWidget(
_buildAppWithDialog(dialog),
_buildAppWithDialog(dialog, theme: ThemeData(useMaterial3: false)),
);

await tester.tap(find.text('X'));
Expand Down Expand Up @@ -1605,6 +1609,7 @@ void main() {

Widget buildFrame(MainAxisAlignment? alignment) {
return MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: GiffyDialog(
giffy: const SizedBox(),
Expand Down

0 comments on commit 86dd84c

Please sign in to comment.