小编Amm*_*ang的帖子

Flutter快餐栏在SnackBarAction onPressed上关闭

我想放弃SnackBarSnackBarActiononPressed方法。我尝试过Navigator.of(context).pop();SnackBar不排除屏幕变黑。

这是代码:

 void showInSnackBar(String value) {
homeScaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text(value),
  action: SnackBarAction(
    label: 'Dissmiss',
    textColor: Colors.yellow,
    onPressed: () {
    //  Navigator.of(context).pop();
    },
  ),));
}
Run Code Online (Sandbox Code Playgroud)

dart snackbar flutter

6
推荐指数
5
解决办法
1880
查看次数

Flutter如何在导航抽屉中添加可扩展菜单项?

我想将可扩展菜单添加到drawer颤动项。我如何才能在颤振中实现此功能。如果有任何示例或博客,请直接指出正确的方向。

在此处输入图片说明

dart flutter flutter-layout

5
推荐指数
1
解决办法
3175
查看次数

如何使Flutter TextField高度匹配容器的父级?

我要使我的TextField高度与我的容器高度相同。请检查以下代码,让我知道如何使TextField容器的match_parent。我已经检查了这个问题,在flutter中相当于wrap_content和match_parent?但没有找到任何解决方案。我需要将TextField容器的高度和宽度全部取整。

 new Container(
            height: 200.0,
            decoration: new BoxDecoration(
                border: new Border.all(color: Colors.black)
            ),

            child: new SizedBox.expand(
              child: new TextField(
                maxLines: 2,
                style: new TextStyle(
                    fontSize: 16.0,
                   // height: 2.0,
                    color: Colors.black
                ),
                  decoration: const InputDecoration(
                    hintText: "There is no data",
                    contentPadding: const EdgeInsets.symmetric(vertical: 40.0),
                  )
              ),
            ),
          )
Run Code Online (Sandbox Code Playgroud)

请检查下面的屏幕截图,我需要TextField全力以赴Container

在此处输入图片说明

dart flutter flutter-layout

5
推荐指数
3
解决办法
7834
查看次数

Flutter 搜索栏布局问题 BoxConstraints 强制无限宽度

我正在尝试模仿类似于附加图像的搜索视图,但出现以下错误。我可以使用 ListTile 实现这一点,但我无法为图标或 TextField 设置填充。所以我试图使用 Row 小部件来实现这一点。请查看我的代码并帮助我绘制此搜索栏。

 I/flutter (19181): The following assertion was thrown during 
 performLayout():
 I/flutter (19181): BoxConstraints forces an infinite width.
 I/flutter (19181): These invalid constraints were provided to 
 RenderAnimatedOpacity's layout() function by the      
 I/flutter (19181): following function, which probably computed 
 the invalid constraints in question:
 I/flutter (19181):   _RenderDecoration._layout.layoutLineBox (package:flutter/src/material/input_decorator.dart:767:11)
 I/flutter (19181): The offending constraints were:
 I/flutter (19181):   BoxConstraints(w=Infinity, 0.0<=h<=46.0) 
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

 new Container(
            height: 70.0,
              color: Theme.of(context).primaryColor,
              child: new Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: new Card(
                      child: new …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

4
推荐指数
1
解决办法
4258
查看次数

Flutter,如何删除对话框周围的空白?

我从服务器获取数据时正在调用此对话框。此对话框周围有空白。我可以删除对话框周围的空白区域。这是我的代码。

var bodyProgress = new Container(
 decoration: new BoxDecoration(
  color: Colors.blue[200],
  borderRadius: new BorderRadius.circular(10.0)
 ),
width: 300.0,
height: 200.0,
//color: Colors.blue,
alignment: AlignmentDirectional.center,
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
  new Center(
    child: new SizedBox(
      height: 50.0,
      width: 50.0,
      child: new CircularProgressIndicator(
        value: null,
        strokeWidth: 7.0,
      ),
    ),
  ),
  new Container(
    margin: const EdgeInsets.only(top: 25.0),
    child: new Center(
      child: new Text(
        "Signing up...",
        style: new TextStyle(
            color: Colors.white
           ),
         ),
       ),
     ),
   ],
  ),
);
Run Code Online (Sandbox Code Playgroud)

在这里,我称此对话框。我尝试过AlertDialog()和SimpleDialog()都存在相同的问题。

showDialog(context: context, …
Run Code Online (Sandbox Code Playgroud)

dialog dart flutter flutter-layout

3
推荐指数
1
解决办法
2601
查看次数

如何在flutter的下拉菜单中设置初始值?

如何在flutter的下拉菜单中设置初始值?

在下拉菜单中,我要设置初始值,当前显示的提示值为“选择语言”。我需要显示初始值。就像我的初始值是English一样,它应该是我的下拉菜单中的选定项。

下面是我的代码:

new DropdownButtonHideUnderline(

               child: new DropdownButton<Language>(
                 hint: new Text("Select Language"),
                 value: selectedLanguage,
                 onChanged: (Language newValue) {
                   applic.onLocaleChanged(new Locale(newValue.languageCode,''));
                   setState(() {
                     selectedLanguage = newValue;
                   });
                 },
                 items: listLanguage.map((Language language) {
                   return new DropdownMenuItem<Language>(
                     value: language,
                     child: new Text(

                       language.languageName ,
                       style: new TextStyle(color: Colors.black),
                     ),
                   );
                 }).toList(),
               ),
             )
Run Code Online (Sandbox Code Playgroud)

我的清单初始化为:

List<Language> listLanguage =
  <Language> [new Language("English", "en"),
  new Language("French", "fr"),
  new Language("Hindi", "hi"),

  ];

 Language selectedLanguage;
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

dart flutter flutter-layout

3
推荐指数
1
解决办法
4194
查看次数

Flutter 更新购物车项目列表,同时删除重复条目

我正在使用购物车应用程序并使用 flutter_redux 来更新我的购物车。一切正常,但我的购物车列表中出现重复项目,如何删除这些重复条目并添加数量。我想获得包含物品和数量的清单。请帮助我使用这段代码,我可以在哪里添加逻辑并使用已删除的重复项过滤列表。

这是我的代码:

carItemReducer.dart

List<CartItem> cartItemReducer(List<CartItem> items, dynamic action)
{
 if(action is AddItemAction)
 {
   return addItem(items, action);
 }
  else if (action is DeleteItemAction)
   {
     return deleteItem(items, action);
   }

 return items;
}

List<CartItem> addItem(List<CartItem> items, AddItemAction action)
{
 return new List.from(items)..add(action.item);
}

List<CartItem>  deleteItem(List<CartItem> items, DeleteItemAction action)
{

return new List.from(items)..remove(action.item);
}
Run Code Online (Sandbox Code Playgroud)

从此代码将商品添加到我的购物车:

Widget futureWidget()
 {

    return new FutureBuilder<List<ModelProductDetail>>(

    future: getDetailProductFuture(),
    builder: (BuildContext context, AsyncSnapshot snapshot){

      if(snapshot.hasData)
      {
        Widget addRemoveButtonRedux = new StoreConnector<
        List<CartItem>, OnItemAddedCallback>(
          converter: (store)
          =>(itemName) => store.dispatch( …
Run Code Online (Sandbox Code Playgroud)

cart e-commerce dart flutter

2
推荐指数
1
解决办法
4543
查看次数

如何在flutter中的appBar图标上的购物车图标上添加项目编号?以及如何使它动画添加新项目?

我想在图片中像这样在拍子上添加商品编号,并想在向购物车中添加新商品时进行动画处理。我的购物车图标在appBar中。

在此处输入图片说明

animation dart flutter

1
推荐指数
3
解决办法
2681
查看次数

在Angular 6中导出为Excel或CSV

我有以下角度6中的表,该表是从数据库动态获取的。

<table *ngIf="attendanceModel.length > 0; else attendanceModel_else" class="table table-responsive" id="table">
    <thead>
      <tr>
        <th>Name</th>
        <th>Designation</th>
        <th>Morning Session</th>
        <th>Evening Session</th>
        <th>Total Hours</th>
        <th>Status</th>
      </tr>
    </thead>
    <tbody>
      <ng-container *ngFor="let attendance of attendanceModel | groupBy:'employee_id'">
        <tr>
          <td colspan="6" class="text-center text-muted"> &laquo; Name: {{ attendance.key }} &raquo; </td>
        </tr>
        <tr *ngFor="let attendance of attendance.value">
            <td>{{attendance.employee_id.profile.first_name}} {{attendance.employee_id.profile.last_name}}</td>
            <td>{{attendance.employee_id.designation}}</td>
            <td>{{attendance.morning_session}}</td>
            <td>{{attendance.evening_session}}</td>
            <td>{{attendance.total_hours | number:'1.0-1' }}</td>
            <td *ngIf="attendance.status == 'Verified'; else inactive_else">
              <a class="btn btn-link text-success p-0" (click)="notVerify(attendance._id)">{{attendance.status}}</a>
            </td>
            <ng-template #inactive_else>
              <td *ngIf="attendance.status == 'Not Verified'">
                <a class="btn …
Run Code Online (Sandbox Code Playgroud)

export-to-excel mongodb node.js export-to-csv angular6

1
推荐指数
1
解决办法
1万
查看次数