전체 글93 [flutter] bottomNavigationBar위에서 Hero 구현 : Hero와 Navigator의 관계(HeroController Observing) bottomNavigationBar를 사용하고있고 그 안에서 네개의 탭이 각각의 Navigator를 가지고 있다. 그렇게 각각의 Navigator를 부여한 이유는 rootNavigator과 분리해야 rootNavigator에 존재하는 bottomNavigatorBar의 형태를 유지시킬 수 있기 때문이다. 하지만 각 탭에 새로운 Navigator를 '생으로' 적용하면 Navigation의 기능과 관련된 기능들이 사용되지 않을 수 있다. 내가 겪은 예는 바로 Hero이다. Hero는 Navigation 도중 적용되는 기능 중 하나다. 하지만 생으로 만든 Navigator위에서 routing될 때 사용하면 적용되지 않는다. 그에 반해, Navigator.of의 속성안에 rootNavigator: true 를.. 2020. 10. 7. [flutter] initstate에 Provider 사용하기 : WidgetBinder 전 화면의 이미지를 다음 화면에 가져와 initState에서 Provider로 widget.[데이터]를 공급해야 할 일이 있다. 하지만 생으로 initState에 @override void initState() { // TODO: implement initState super.initState(); Provider.of(context).set(); } 이렇게 사용하면 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4233 pos 12: '!_dirty': is not true. Either the assertion indicates an error in the framework itself, or we should provide.. 2020. 8. 13. [flutter] /bin/sh: ~~~/flutter/packages/flutter_tools/bin/xcode_backend.sh:Operation not permitted 에러해결 Operation not permitted 에러는 위와같이 전체 디스크 접근 권한에 해당 앱(xcode)을 추가함으로써 해결할 수 있다. 2020. 7. 31. [flutter] showModalBottomSheet() 테두리 수정 1.문제 showModalBottomSheet에서 테두리를 수정할 때 가장 안쪽의 Container의 테두리를 수정하면 아무 변화도 나타나지 않는다. 2. 해결 바깥에 Container를 한번 더 감싸준 다음 바깥 Container의 color을 기본 modalBottomSheet의 그림자 색깔인 Color(0xFF737373) 으로 설정하면 바뀐 모습을 볼 수 있다. showModalBottomSheet( context: context, builder: (context) { return Container( height: _width, color: Color(0xFF737373), child: Container( decoration: BoxDecoration( color: Colors.white, bor.. 2020. 7. 6. [flutter-error] 에러 flutter: Error: Could not find the correct Provider<...> above this ~~ 해결 에러: flutter: Error: Could not find the correct Provider above this HotPlacePage Widget To fix, please: * Ensure the Provider is an ancestor to this HotPlacePage Widget * Provide types to Provider * Provide types to Consumer * Provide types to Provider.of() * Ensure the correct `context` is being used. 해결 MainPage.dart에서 Multiprovider에 해당 Provider를 ChangeNotifierProvider로 등록한다 2020. 6. 19. [flutter] Row긴한데 기본적인 정렬이 들어가야할 때 : Stack + Align 1. 배경 Flutter에서는 정말 많은 위젯들을 제공하고 그 사용법 또한 간단하기 때문에 알기만 훨씬 효과적으로 ui를 짤 수 있어 아는것이 힘인 프레임워크라고 할 수 있다. 하지만 위젯이 많은 만큼 그 많은 위젯을 모두 외우기 힘들고 특정한 상황에서 어떤 위젯이 가장 어울리는지 결정하는것 또한 하나의 일이될 수 있다. 특정 상황에 걸맞는 위젯이 존재하는데도 그 당시에는 알지못하여 다른 위젯들을 사용하여 겨우겨우 구현해냈다가 걸맞는 위젯을 나중에서야 알게되어 '아..진작이 이 위젯을 알았다면..'하고 현자가 되는 경우가 다반사이다. (물론 필자같이 입문한지 얼마 안 된 개발자에 한해!) 아까말한대로 Flutter는 수많은 위젯들을 제공하지만 필자가 의외로(?) 고생한 부분이 '레이아웃'부분이다. Flu.. 2020. 6. 19. [flutter] Flexible Flexible의 fit 속성 - FlexFit.tight: 아래 child의 높이가 뭐든 상관없이 다른 Flexible과 같은 비율을 차지하게 된다 import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: [ Flexible( flex: 1, fit: FlexFit.tight, //아래 child의 높이가 뭐든 상관없이 다른 Flexible과 같은 비율을 차지하게 된.. 2020. 6. 18. [flutter] Future, 그리고 async await Flutter를 시작한 지 얼마되지 않은 개발자분들 중 필자같이 Future와 async await의 관계 혹은 차이에 대해 헷갈리는 분들이 있을 수 있다. 그 관계, 그리고 차이에 대해 예제와 함께 알아보겠다. 핵심은 다음과 같다 1. Future함수, async함수들을 모두 await하지 않았을 때 2. Future함수를 await! 3. async함수를 await! 4. Future함수를 갖고있는 변수의 Type결정(Future형 vs T형) 기본적으로 사용하는 예제는 다음과 같다 void main() { print('Main program: Starts'); printFileContent(); print('Main program: Ends'); } printFileContent() { Future.. 2020. 6. 18. 이전 1 2 3 4 5 6 7 8 ··· 12 다음