首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MaterialApp刚刚开始奇怪地创建我没有点击的屏幕

MaterialApp刚刚开始奇怪地创建我没有点击的屏幕
EN

Stack Overflow用户
提问于 2020-06-03 07:00:09
回答 1查看 27关注 0票数 0

我的MaterialApp今天开始表现得很奇怪。当我单击管理选项卡时,TournamnetScreen被创建了两次。

是什么导致了这一切?我昨天升级了颤振。(稳定通道)

代码语言:javascript
复制
@override
Widget build(BuildContext context) {

debugPrint("Starting Chess Champion");

return MaterialApp(
  theme: new ThemeData(
    primarySwatch: Colors.blue,
    scaffoldBackgroundColor: Colors.grey
  ),
  home: DefaultTabController(
    length: 5,
    child:
    Scaffold(
      appBar: AppBar(
        title: Text('Chess Champion', style: new TextStyle(fontWeight: FontWeight.normal, fontSize: 30.0)),
        bottom: TabBar(
          tabs: [
            Tab(icon: Icon(Icons.home)),
            Tab(icon: Icon(AntDesign.table)),
            Tab(icon: Icon(Octicons.versions)),
            Tab(icon: Icon(MaterialCommunityIcons.podium)),
            Tab(icon: Icon(Octicons.tools)),
          ],
        ),
      ),
      body: TabBarView(
        children: [
          HomeScreen(title: 'Home',),
          DataTableScreen(),
          ChangelogScreen(),
          TeamTournamentScreen(),
          AdminScreen(),
        ],
      ),
    ),
  ),
);

}

这里的管理小部件。

代码语言:javascript
复制
class AdminScreen extends StatelessWidget {
final _scaffoldKey = GlobalKey<ScaffoldState>();

@override
Widget build(BuildContext context) {
return Scaffold(
  key: _scaffoldKey,
  appBar: AppBar(title: Text('Admin')),
  body: Builder(builder: (BuildContext context) {
    return Column(
      children: <Widget>[
        RaisedButton(
          onPressed: _createTour2,
          child: new Text('Create a tournament2'),
        ),
        RaisedButton(
          onPressed: _readTour,
          child: new Text('Read a tournament'),
        ),
        RaisedButton(
          onPressed: _deleteTour,
          child: new Text('Delete a tournament'),
        ),
        RaisedButton(
          onPressed: _setTourLevel,
          child: new Text('Set level in all Tournaments'),
        ),
        RaisedButton(
          onPressed: _listTours,
          child: new Text('List Tournaments'),
        ),
        RaisedButton(
          onPressed: _listTour2s,
          child: new Text('List Tournament2s '),
        ),
        RaisedButton(
          onPressed: _deleteDuplicatedTours,
          child: new Text('Delete Duplicated Tournaments'),
        ),
        RaisedButton(
          onPressed: _scrapeAllsvenskan,
          child: new Text('Scrape Allsvenskan'),
        ),
        RaisedButton(
          onPressed: _listClubs,
          child: new Text('List Clubs'),
        ),
        RaisedButton(
          onPressed: _updateTour,
          child: new Text('Update a Tournament'),
        ),
        RaisedButton(
          onPressed: _deleteDuplicatClubs,
          child: new Text('Remove duplicate Clubs'),
        ),
        RaisedButton(
          onPressed: _dbCounts,
          child: new Text('Database Counts'),
        ),
      ],
    );
  }),
);
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-07 05:56:06

事实证明,我无意中创建了两个MaterialApp。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62167010

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档