관리 메뉴

cococo-coding

[Flutter/Android Studio] None of the files were in this project content 에러 본문

[Flutter] Todolist/트러블슈팅

[Flutter/Android Studio] None of the files were in this project content 에러

_dani 2024. 2. 10. 20:26
발생

 

Refactor> Extract Method를 하는 와중에 다음과 같은 에러가 발생했다. 

스택오버플로우에 나온 방법을 시도해봤는데도 계속해서 같은 에러가 발생...

 

방법

 

원래는 저렇게 클릭 몇 번으로 쉽게 바뀔 코드인데 결국 일일이 다 바꿔줬다. 

 

바꾼 코드내용이다. 

바꿀 때는 괄호짝이나 개수에 주의하자!

import 'package:flutter/material.dart';
import 'package:flutter_todolist_app/constants/colors.dart';

class Home extends StatelessWidget {
const Home({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: toBGColor,
appBar: _buildAppBar(),
body: Container(
child: Text('This is home screen.'),
),
);
}

AppBar _buildAppBar(){
return AppBar(
backgroundColor: toBGColor,
elevation: 0,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
Icons.menu,
color: toBlack,
size:30,
),
Container(
height: 40,
width: 40,
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child:Image.asset('assets/images/avatar.jpg'),
),
),
]),
);
}
}