制作完整文件时如何合并颤振文件

时间:2021-02-02 16:00:52

标签: flutter dart

我正在做一个颤振项目

我想合并很多我制作的小部件。

但我无法合并......

如果我尝试合并它发生错误。

enter image description here

enter image description here

我该如何解决这个问题? 我不知道..... 请告诉我。

这是我的代码 enter image description here

******* 这里是列 ************ 中的代码

1.lendproductlist -> 它实际上只是列表视图示例 2.search bar -> 是searchbar布局 3.应用栏

import 'package:flutter/material.dart';

void main() => runApp(LendProductList());

/// This is the main application widget.
class LendProductList extends StatelessWidget {
  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      home: Scaffold(
        appBar: null,
        body: MyStatelessWidget(),
      ),
    );
  }
}

class CustomListItem extends StatelessWidget {
  const CustomListItem({
    this.thumbnail,
    this.title,
    this.user,
    this.viewCount,
  });

  final Widget thumbnail;
  final String title;
  final String user;
  final int viewCount;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 5.0),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Expanded(
            flex: 2,
            child: thumbnail,
          ),
          Expanded(
            flex: 3,
            child: _VideoDescription(
              title: title,
              user: user,
              viewCount: viewCount,
            ),
          ),
          const Icon(
            Icons.more_vert,
            size: 16.0,
          ),
        ],
      ),
    );
  }
}

class _VideoDescription extends StatelessWidget {
  const _VideoDescription({
    Key key,
    this.title,
    this.user,
    this.viewCount,
  }) : super(key: key);

  final String title;
  final String user;
  final int viewCount;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.fromLTRB(5.0, 0.0, 0.0, 0.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(
            title,
            style: const TextStyle(
              fontWeight: FontWeight.w500,
              fontSize: 14.0,
            ),
          ),
          const Padding(padding: EdgeInsets.symmetric(vertical: 2.0)),
          Text(
            user,
            style: const TextStyle(fontSize: 10.0),
          ),
          const Padding(padding: EdgeInsets.symmetric(vertical: 1.0)),
          Text(
            '$viewCount views',
            style: const TextStyle(fontSize: 10.0),
          ),
        ],
      ),
    );
  }
}

/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
  MyStatelessWidget({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 400,
      child: ListView(
        padding: const EdgeInsets.all(8.0),
        itemExtent: 106.0,
        children: <CustomListItem>[
          CustomListItem(
            user: 'Flutter',
            viewCount: 999000,
            thumbnail: Container(
              decoration: const BoxDecoration(color: Colors.blue),
            ),
            title: 'The Flutter YouTube Channel',
          ),
          CustomListItem(
            user: 'Dash',
            viewCount: 884000,
            thumbnail: Container(
              decoration: const BoxDecoration(color: Colors.yellow),
            ),
            title: 'Announcing Flutter 1.0',
          ),
        ],
      ),
    );
  }
}

import 'package:flutter/material.dart';

void main() => runApp(SearchbarApp());

class SearchbarApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title:'searchbar',
      home: SearchbarScreen(),
    );
  }
}

class SearchbarScreen extends StatefulWidget {
  @override
  _SearchbarScreenState createState() => _SearchbarScreenState();
}

class _SearchbarScreenState extends State<SearchbarScreen> {
  final TextEditingController _textController = new TextEditingController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: null,
        body: _buildTextComposer(),
      ),
      );


  }


  Widget _buildTextComposer() {
    return IconTheme(
        data: IconThemeData(color: Theme
            .of(context)
            .accentColor),
        child: Container(
          margin: const EdgeInsets.symmetric(horizontal: 8.0),
          child: Row(
            children: <Widget>[
              Container(
                width: 280,

                child:  TextField(
                  controller: _textController,
                  onSubmitted: _handleSubmitted,
                  decoration: new InputDecoration.collapsed(
                      hintText: "검색어를 입력하세요."),
                ),
                ),


              Container(
                margin: const EdgeInsets.symmetric(horizontal: 4.0),
                child: IconButton(
                    icon: Icon(Icons.search),
                    onPressed: () => _handleSubmitted(_textController.text)),
              ),

            ],
          ),
        )


    );
  }
  void _handleSubmitted(String text) {
    _textController.clear();
  } }

import 'package:flutter/material.dart';

void main() => runApp(BillrunAppbar());

class BillrunAppbar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home:Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.white,
          title: Text("BULL RUN",style: TextStyle(fontSize: 30.0, fontWeight : FontWeight.bold,color:Colors.black),

          ),
        ),

      )
    );
  }
}

1 个答案:

答案 0 :(得分:0)

您需要为应用程序创建一个类,并为其放置现有的小部件:

  1. 只创建一个 <form name="my-form" id="investments"> <div id="formpage_1" style="visibility: visible; display: block;"> <h3>1. My timeframe until retirement is </h3> <label><input type="radio" value="-15" name="price1">Less than 3 years</label><br> <label><input type="radio" value="-10" name="price1">Less than 5 years</label><br> <label><input type="radio" value="0" name="price1">More than 7 years</label><br> <label><input type="radio" value="0" name="price1">More than 10 years</label><br> <br> <input type="button" value="Next" onclick="javascript:pagechange(1,2);"> </div> </form> 类;
  2. App 类中声明 App;
  3. 从小部件中移除 Material 应用,例如:
AppBar
  1. 如果您使用固定的小部件尺寸并且屏幕上有许多小部件,请将其父级包装为 class LendProductList extends StatelessWidget { @override Widget build(BuildContext context) { return MyStatelessWidget() } } ListView