v1.0.6+4
the_responsive_builder
このFlutterパッケージは、レスポンシブなFlutterアプリケーションの構築を支援するためのユーティリティのセットを提供します。
16いいね 1630日間ダウンロード140Pub ポイント
AndroidiOSWebmacOSWindowsLinux
このFlutterパッケージは、さまざまな画面サイズおよび向きに適応するレスポンシブなFlutterアプリの構築を支援するユーティリティのセットを提供します。
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
This package provides a set of utilities to aid in building responsive Flutter applications that adapt to different screen sizes and orientations.
Firstly, add package to pubspec.yaml.
Then, wrap your main MaterialApp widget with the TheResponsiveBuilder
void main() => runApp(
TheResponsiveBuilder(
builder: (context, orientation, screenType) {
return MaterialApp(
//... your other MaterialApp properties
);
},
),
);
With the utilities set up, you can easily use the extensions provided:
// This will set the height to 20% of the screen height
Container(height: 20.h, ...);
// This will set the width to 50% of the screen width
Container(width: 50.w, ...);
// This uses a logarithmic formula to scale UI elements based on screen size and pixel density.
TextStyle(fontSize: 16.dp, ...);
// This scales the text size based on the user's font size settings.
TextStyle(fontSize: 16.sp, ...);
if (context.screenType == ScreenType.mobile) {
// Build UI for mobile
} else {
// Build UI for tablet
}
if (context.orientation == Orientation.portrait) {
// Build UI for portrait mode
} else {
// Build UI for landscape mode
}
// Lock screen orientation to Portrait mode
context.lockToPortrait();
// Lock screen orientation to Landscape mode
context.lockToLandscape();
// Unlock screen orientation to automatic mode
context.unlockOrientation();
依存関係一覧 3 件
{"sdk":"flutter"}{"sdk":"flutter"}^4.0.0用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗