컨테이너 내부에 너비와 높이가 고정 된 버튼을 갖고 싶습니다. 그러나 어떤 이유로 버튼은 컨테이너의 높이와 너비를 차지합니다. 나는 사용하여 시도 SizedBox
하고 ButtonTheme
있지만 잘 작동하지 않습니다.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
debugPaintSizeEnabled = true;
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
// home: EditorScreen(),
home: Scaffold(
body: SafeArea(
child: Container(
height: 65,
width: double.infinity,
color: Colors.black,
child: SizedBox(
height: 50,
width: 50,
child: ButtonTheme(
minWidth: 50,
height: 50,
child: FlatButton(
onPressed: () {},
color: Colors.red,
child: Text("Test"),
),
),
),
),
),
),
);
}
}
상위 컨테이너 alignment
속성에 대해 지정 합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다