홈>
플러터에서 카드로 블로그 기사 팝업을 만들려고했지만 앱을 실행할 때마다 아무 것도 나타나지 않습니다. Card 객체를 onTap 문에 넣었습니다.
코드는 다음과 같습니다 :
article_view.dart
import 'package:flutter/material.dart';
import 'package:scip_app/articles_data.dart';
class _ArticleListItem extends ListTile {
_ArticleListItem(Article article) :
super(
title: new Text(article.title),
subtitle: new Text(article.blurb),
onTap: () {
new FullArticleDisplay(article);
}
);
}
class FullArticleDisplay extends StatelessWidget {
final Article article;
FullArticleDisplay(this.article);
@override
Widget build(BuildContext context) {
return new Container(
child: new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new ListTile(
title: new Text(article.title),
),
new Text(article.articled),
]
)
)
);
}
}
class ArticleList extends StatelessWidget {
final List<Article> _articles;
ArticleList(this._articles);
@override
Widget build(BuildContext context) {
return new ListView(
padding: new EdgeInsets.symmetric(vertical: 8.0),
children: _buildArticleList()
);
}
List<_ArticleListItem> _buildArticleList() {
return _articles.map((artic) => new _ArticleListItem(artic)).toList();
}
}
class ArticlesPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Articles")
),
body: new ArticleList(kArticles)
);
}
}
다른 파일은 다음과 같습니다. https://pastebin.com/rS2fLktF
- 답변 # 1
관련 질문
- android : 처리되지 않은 예외: '_InternalLinkedHashMap
' 유형은 'ReferralPolicyResponse?' 유형의 하위 유형이 아닙니다. 실룩 거리다 - android : flutter:-내 code를 실행하려고 할 때 ID가 존재하지 않습니다.
- android : Flutter는 이상한 양수 하단 패딩과 음수 상단 패딩으로 중국어 텍스트를 렌더링하므로 텍스트를 세로로 가운데에 맞출 수 없습니다.
- android : 10진수 값을 한 번만 사용하고 싶습니다 -flutter
- android : 내 서랍의 버튼이 아무 작업도 하지 않는 이유는 무엇입니까?
- javascript : React 네이티브를 사용하여 버튼 클릭 시 앱에서 글꼴 크기를 변경하는 방법
- android : Google 호스팅 URL에 대해 딥링크가 작동하지 않음
- android : Flutter BottomNavigationBarItem 아이콘과 레이블을 같은 줄에 만드는 방법
- android : 이전에 설치된 모바일 앱의 새 버전을 테스트하는 방법
- android : 웹 사이트에서 링크를 클릭한 후 iPhone 카메라 앱을 여는 웹 링크?
위젯을 만드는 것처럼 보이지만 어디에도 배치하지는 않습니다. 대화 상자를 표시하려고합니까? 그렇다면 showDialog 호출에서 새 FillArticleDisplay로 호출을 줄 바꿈하십시오. 또는 setState를 호출하고 위젯을 어딘가에 저장하여 빌드 메소드에 포함시킬 수 있습니다.