본문 바로가기

container10.4

Flutter 슬리버리스트와 리스트뷰의 차이점은 무엇인가요?, Differences between SliverList vs ListView in Flutter 질문 Flutter에서 SliverList와 ListView의 차이점은 무엇인가요? 답변 차이는 거의 없습니다. ListView는 SliverList입니다. GridView도 마찬가지로 SliverGrid입니다. 둘 다 정확히 같은 일을 합니다. 그들 사이의 유일한 차이점은 SliverList가 위젯이 아니라 슬리버(sliver)라는 것입니다. 즉, 보통 CustomScrollView 내에서 사용되는 ScrollView 내에서 사용됩니다. ListView는 SliverList를 위젯으로 바인딩하여 Row/Container와 같은 다른 위젯과 함께 사용할 수 있도록 만드는 것입니다. 대부분의 경우, ListView를 사용하십시오. 그러나 스크롤과 함께 앱바 애니메이션과 같은 고급 스크롤 동작이 필요한 경우.. 2024. 1. 3.
Flutter 플러터: 버튼을 부모 요소의 크기로 확장하는 방법은 무엇인가요?, Flutter: How to make a button expand to the size of its parent? 질문 I am trying to create square buttons, but Expanded doesn't seem to work the same as it does with containers. Take the following code for example new Expanded( flex: 2, child: new Column( children: [ new Expanded( child:new Row( children: [ new Expanded(child: new MaterialButton(...)), new Expanded(child: new MaterialButton(....)), new Expanded(child: new Container(color: Colors.red)), new Exp.. 2023. 10. 1.
Flutter 플러터에서 가로로 스크롤 가능한 카드들과 스냅 효과를 구현해주세요., Horizontally scrollable cards with Snap effect in flutter 질문 나는 좌우로 스와이프할 때 적합한 스냅 효과가 있는 가로로 스크롤되는 카드 목록을 만들고 싶습니다. 각 카드 사이에 일정한 간격이 있으며 아래 이미지와 같이 화면에 맞게 조정됩니다. 또한, 이 가로로 스크롤 가능한 목록 요소는 수직으로 스크롤 가능한 목록 내에 포함되어야 합니다. 내가 달성한 것은 플러터 문서를 따라가며 가로로 스크롤되는 카드 목록만 표시하는 것입니다. class SnapCarousel extends StatelessWidget { @override Widget build(BuildContext context) { final title = '가로 목록'; return MaterialApp( title: title, home: Scaffold( appBar: AppBar( title:.. 2023. 8. 11.
Flutter 플러터에서 ModalBottomSheet의 상태를 업데이트하는 방법은 무엇인가요?, How to update state of a ModalBottomSheet in Flutter? 질문 이 코드는 매우 간단합니다: 모달 바닥 시트를 보여주고 사용자가 버튼을 클릭하면 시트의 높이를 10만큼 증가시킵니다. 하지만 아무 일도 일어나지 않습니다. 실제로, 사용자가 바닥 시트를 "슬라이드"하여 크기를 업데이트합니다(스와이프가 시트의 내부 상태를 업데이트한다고 믿습니다). 제 질문은: 모달 바닥 시트의 상태 업데이트를 어떻게 호출할 수 있을까요? showModalBottomSheet( context: context, builder: (context) { return Container( height: heightOfModalBottomSheet, child: RaisedButton( onPressed: () { setState(() { heightOfModalBottomSheet += 10; .. 2023. 7. 19.