Flutter - Adaptive and Responsive

godo·2022년 6월 5일
0

Flutter

목록 보기
18/18

MediaQuery

height: MediaQuery.of(context).size.height * 0.6,
height: (MediaQuery.of(context).size.height - appBar.preferredSize.height),

다른 요소 사용

 height: (MediaQuery.of(context).size.height -
                          appBar.preferredSize.height - MediaQuery.of(context).padding.top) *
                      0.4,

LayoutBuilder

LayoutBuilder(builder: (ctx, constraints) {
	...
    height: constraints.maxHeight * 0.15,
    ...
}

SoftKeyboard Insets

padding: EdgeInsets.only(
            top: 10, 
            left: 10, 
            right: 10, 
            bottom: MediaQuery.of(context).viewInsets.bottom + 10,
          ),

하고 SingleChildScrollView 로 감싸면 좋음

checking platform

import 'dart:io';

...

Platform.isIOS ? ~~

iOS

import 'package:flutter/cupertino.dart';



return Platform.isIOS 
    ? CupertinoPageScaffold(
      child: pageBody,
    ) 
    : Scaffold( ...
profile
☀️☀️☀️

0개의 댓글