본문 바로가기

coding47

Flutter 플러터에서 열 너비 설정하기, Set column width in flutter 질문 I need to set a Column width in flutter, I have to do a layout with 3 sections, one should be 20% of the screen, the other one 60% and the last one 20%. I know that those 3 columns should be into a row, but I don't know a way to set the size, when I do that, the 3 columns take the same size. I will appreciate any feedback. 답변 크기를 하드 코딩하는 대신 Flex를 사용하는 것을 제안합니다. Row( children: [ Expanded( flex.. 2023. 6. 24.
Flutter 플러터에서 텍스트 위젯에 아이콘을 표시하는 방법은 무엇인가요?, How to show Icon in Text widget in flutter? 질문 나는 텍스트 위젯에서 아이콘을 보여주고 싶습니다. 어떻게 해야 할까요? 다음 코드는 IconData만 보여줍니다. Text("Click ${Icons.add} to add"); 답변 Flutter는 RichText() 내부에 위젯을 추가하기 위해 WidgetSpan()을 사용합니다. 예시: RichText( text: TextSpan( children: [ TextSpan( text: "Click ", ), WidgetSpan( child: Icon(Icons.add, size: 14), ), TextSpan( text: " to add", ), ], ), ) 위 코드는 다음과 같은 결과를 출력합니다: WidgetSpan의 자식 요소를 일반적인 위젯과 같이 다룰 수 있습니다. 2023. 6. 24.
Flutter 다트에서 리스트의 시작 부분에 요소를 삽입합니다., Insert element at the beginning of the list in dart 질문 저는 Flutter에서 간단한 ToDo 앱을 만들고 있습니다. 모든 할 일 목록을 관리하고 있습니다. 새로운 할 일을 목록의 맨 앞에 추가하고 싶습니다. 이를 위해 이러한 해결책을 사용할 수 있습니다. 더 나은 방법이 있을까요? void _addTodoInList(BuildContext context){ String val = _textFieldController.text; final newTodo = { "title": val, "id": Uuid().v4(), "done": false }; final copiedTodos = List.from(_todos); _todos.removeRange(0, _todos.length); setState(() { _todos.addAll([newTodo, ... 2023. 6. 18.
Python 파이썬을 사용하여 시스템 호스트 이름을 어떻게 가져올 수 있나요?, How can I use Python to get the system hostname? 질문 I'm writing a chat program for a local network. I would like be able to identify computers and get the user-set computer name with Python. 답변 socket와 그것의 gethostname() 기능을 사용합니다. 이렇게 하면 Python 인터프리터가 실행되는 컴퓨터의 hostname을 가져올 수 있습니다: import socket print(socket.gethostname()) 2023. 6. 10.