-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update to match internal repo (#24)
fix: [TM-42170] Support links in table fix:[TM-42460] Reset resetPreferredOrientations after camera dispose fix: [TM-43252] taking time to capture an image
- Loading branch information
1 parent
bc84094
commit bceb856
Showing
5 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
||
/// Controls orientations of the application interface | ||
class ZdsSystemChrome { | ||
static List<DeviceOrientation> _orientations = [ | ||
DeviceOrientation.portraitUp, | ||
DeviceOrientation.portraitDown, | ||
DeviceOrientation.landscapeLeft, | ||
DeviceOrientation.landscapeRight, | ||
]; | ||
|
||
/// Get the set of orientations the application interface can | ||
/// be displayed in. | ||
static List<DeviceOrientation> get appOrientations => _orientations; | ||
|
||
/// Specifies the set of orientations the application interface can | ||
/// be displayed in. | ||
/// | ||
/// The `orientation` argument is a list of [DeviceOrientation] enum values. | ||
static Future<void> setPreferredOrientations(List<DeviceOrientation>? orientations) async { | ||
final platformMediaQuery = MediaQueryData.fromView(PlatformDispatcher.instance.views.first); | ||
if (orientations == null || orientations.isEmpty) { | ||
if (platformMediaQuery.size.shortestSide < 600) { | ||
_orientations = [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]; | ||
} else { | ||
_orientations = [ | ||
DeviceOrientation.portraitUp, | ||
DeviceOrientation.portraitDown, | ||
DeviceOrientation.landscapeLeft, | ||
DeviceOrientation.landscapeRight, | ||
]; | ||
} | ||
} else { | ||
_orientations = orientations; | ||
} | ||
|
||
await resetAppOrientations(); | ||
} | ||
|
||
/// Set the set of orientations the application interface can | ||
/// be displayed in. | ||
static Future<void> resetAppOrientations() async { | ||
await SystemChrome.setPreferredOrientations(appOrientations); | ||
} | ||
} |