이 영역을 누르면 첫 페이지로 이동
caputdraconis 블로그의 첫 페이지로 이동

caputdraconis

페이지 맨 위로 올라가기

caputdraconis

네트워크 관점에서의 클라우드 컴퓨팅을 공부하는 중입니다 :)

[오류-해결] setState 오류

  • 2021.08.14 00:33
  • 언어&프레임워크/Flutter
글 작성자: caputdraconis
반응형

/* 갑자기 뜬금없이 나온 오류에 대해서 투정하는 글입니다. 정확한 이유를 알게되면 업데이트.. */

 

 

아래의 WEIGHT 섹션에서 + - 버튼을 Floation Action Button 으로 만들려다가...

https://api.flutter.dev/flutter/material/FloatingActionButton-class.html

 

Floating Action Button은 한 화면에 쓰라고,,, 공식문서 말은 들어야지 후우

 

 

 

 

그래서! RawMaterialButton을 이용하여 FloatingActionButton과 똑같이 생긴 친구로 하나 만들어보기로 했다.

 

 

class RoundIconButton extends StatelessWidget {

  RoundIconButton({required this.icon, required this.onPressedFunc});
  final IconData icon;
  final Function onPressedFunc;

  @override
  Widget build(BuildContext context) {
    return RawMaterialButton(
      child: Icon(icon),
      onPressed: (){
        onPressedFunc();
      },
      elevation: 0.0,
      constraints: BoxConstraints.tightFor(
        width: 56.0,
        height: 56.0,
      ),
      shape: CircleBorder(),
      fillColor: Color(0xFF4C4F5E),
    );
  }
}

대충 요로코롬 만들어주고~ onPressed에 들어갈 함수 onPressedFunc로 

 

 

 

오잉,,, 글 쓰다 보니 해결~ 와우!!! 

 

// 필요한 부분만 담았습니다..


// Function(modify weight var)
void setWeight(int delta){
    setState(() {
      weight += delta;
    });
  }
  
  
 
 
 class RoundIconButton extends StatelessWidget {

  RoundIconButton({required this.icon, required this.onPressedFunc});
  final IconData icon;
  final Function onPressedFunc;

  @override
  Widget build(BuildContext context) {
    return RawMaterialButton(
      child: Icon(icon),
      onPressed: (){
        onPressedFunc();
      },
      elevation: 0.0,
      constraints: BoxConstraints.tightFor(
        width: 56.0,
        height: 56.0,
      ),
      shape: CircleBorder(),
      fillColor: Color(0xFF4C4F5E),
    );
  }
}

요로코롬에~

 

 

요로코롬 하니깐~ 완성~

반응형

댓글

이 글 공유하기

  • 구독하기

    구독하기

  • 카카오톡

    카카오톡

  • 라인

    라인

  • 트위터

    트위터

  • Facebook

    Facebook

  • 카카오스토리

    카카오스토리

  • 밴드

    밴드

  • 네이버 블로그

    네이버 블로그

  • Pocket

    Pocket

  • Evernote

    Evernote

다른 글

  • [오류-해결] 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5067 pos 12: '!_debugLocked': is not true 오류

    [오류-해결] 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5067 pos 12: '!_debugLocked': is not true 오류

    2021.08.16
다른 글 더 둘러보기

정보

caputdraconis 블로그의 첫 페이지로 이동

caputdraconis

  • caputdraconis의 첫 페이지로 이동

검색

메뉴

    카테고리

    • 분류 전체보기 (168)
      • Cloud (3)
      • Computer Network (12)
      • Database (2)
      • Terraform (2)
      • 🥚고리즘 (13)
      • 겅부겅부🙃 (10)
        • Naver CS50 코칭스터디 (2)
        • Machine Learning (1)
        • Computing System (6)
      • 언어&프레임워크 (20)
        • Python (4)
        • Django (10)
        • Node JS (1)
        • C++ (2)
        • Java (1)
        • Flutter (2)
      • Security (76)
        • WebHacking Study (11)
        • 지옥방 스터디 (22)
        • 여름방학 스터디 (2)
        • PWN Study (6)
        • SUA Reversing Study (3)
        • PWN (3)
        • WebHacking (20)
        • Reversing (4)
      • 알고 있으면 도움되지 않을까,,? (23)
      • 일상다반사 (1)
      • 근황 정리 (1)
      • 42 Seoul (1)
        • Setting (1)

    최근 글

    인기 글

    댓글

    공지사항

    아카이브

    태그

    • 리스트함수
    • 파이썬함수
    • 드림핵
    • 파이썬
    • Python
    • 파이썬기초
    • old-16
    • 웹해킹.kr

    나의 외부 링크

    • Github
    • solved.ac
    • caputdraconis@kakao.com

    정보

    caputdraconis의 caputdraconis

    caputdraconis

    caputdraconis

    블로그 구독하기

    • 구독하기
    • RSS 피드

    방문자

    • 전체 방문자
    • 오늘
    • 어제

    티스토리

    • 티스토리 홈
    • 이 블로그 관리하기
    • 글쓰기
    Powered by Tistory / Kakao. Copyright © caputdraconis.

    티스토리툴바