小编Jen*_*ens的帖子

如何在 VS Code 中调试 flutter build_runner 构建?

问题陈述:

我正在使用build_runner包构建一个代码生成器。

我运行flutter pub run build_runner build来执行我的代码生成器。

问题:

如何flutter pub run build_runner build使用断点进行调试?

类似问题:

如何在intellij idea中以调试模式运行flutter'packages pub run build_runner build'?

code-generation build dart flutter build-runner

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

处理水平步进器溢出

我用几个步骤实现了一个非常简单的水平步进器。但是,我收到溢出横幅,指出我的步骤不适合视图。

如何使带有可滚动步骤的栏?

import 'package:flutter/material.dart';

class SetupPage extends StatefulWidget {
  @override
  _SetupPageState createState() => _SetupPageState();
}

class _SetupPageState extends State<SetupPage> {

  List<Step> steps = [
    new Step(title: Text('Step 1'), content: new Container()),
    new Step(title: Text('Step 2'), content: new Container()),
    new Step(title: Text('Step 3'), content: new Container()),
    new Step(title: Text('Step 4'), content: new Container()),
    new Step(title: Text('Step 5'), content: new Container()),
    new Step(title: Text('Step 6'), content: new Container()),
    new Step(title: Text('Step 7'), content: new Container()),
  ];

  @override
  Widget build(BuildContext context) {
    return …
Run Code Online (Sandbox Code Playgroud)

flutter

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

将 DataGrid 的 ItemsSource 绑定到列表

List我正在尝试在 a和 a之间创建绑定DataGrid。我还没有在网上找到有效的解决方案,这很奇怪。

在我的小例子中,我创建了一个具有两个属性和 的List对象:publicAgeName

public class Person
{
    public string Name { get; set; }

    public int Age { get; set; }
}

public ObservableCollection<Person> Collection { get; set; } 

public List<Person> Persons { get; set; }

private void WindowLoaded(object sender, RoutedEventArgs e)
{

    this.Persons = new List<Person>();

    for (int i = 0; i != 35; i++)
    {
        this.Persons.Add(new Person() {Age = i, Name = i.ToString()});
    }

    this.Collection = new ObservableCollection<Person>(this.Persons); …
Run Code Online (Sandbox Code Playgroud)

c# wpf binding datagrid

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

获取Windows资源管理器的进程句柄

我想获取“ Windows资源管理器” Windows(不是Internet Explorer)的句柄。

通常它与

var processes = Process.GetProcesses();
foreach (var process in processes)
{
    var handle = process.Handle;
}
Run Code Online (Sandbox Code Playgroud)

我想做的是以下几点:

将特定的资源管理器窗口移至ForeGround。我已经实现了“ ToForeGround”方法,它对于除Windows资源管理器以外的所有其他Windows都可以正常工作

但是,使用Windows资源管理器时,无论打开多少Windows,我都只能获得任务栏的进程,因此只有一个“ Windows资源管理器”进程。

还是可以向我解释为什么“ Windows资源管理器”与其他程序不同?

c# windows

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

从列表中删除项目后更新UI

如果我删除或添加项目,我想更新我的ListView。现在,我只想删除项目,并立即看到项目的删除。

我的应用程序更复杂,因此我写了一个小示例项目来展示我的问题。

TestItem类包含一些数据项:

class TestItem {
  static int id = 1;
  bool isFinished = false;
  String text;
  TestItem() {
    text = "Item ${id++}";
  }
}
Run Code Online (Sandbox Code Playgroud)

ItemInfoViewWidget是对的UI表示TestItem,如果它完成(当该复选框被更改为true)中删除的项目。

class ItemInfoViewWidget extends StatefulWidget {
  TestItem item;
  List<TestItem> items;

  ItemInfoViewWidget(this.items, this.item);

  @override
  _ItemInfoViewWidgetState createState() =>
      _ItemInfoViewWidgetState(this.items, this.item);
}

class _ItemInfoViewWidgetState extends State<ItemInfoViewWidget> {
  TestItem item;
  List<TestItem> items;

  _ItemInfoViewWidgetState(this.items, this.item);

  @override
  Widget build(BuildContext context) {
    return new Card(
      child: new Column(
        children: <Widget>[
          new Text(this.item.text),
          new Checkbox(
              value: this.item.isFinished, …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

如何在列中对齐小部件?

我想将我的按钮向右对齐。现在,我正在使用在下面的示例中mainAxisAlignment设置为MainAxisAlignment.endlike的 Row 来完成它。然而,这似乎不是一个好方法,因为它有很多代码,我认为这不是这样做的方式。

我已经尝试过Align小部件,但这不起作用。我猜是因为它没有扩展内部小部件,因此Alignment.centerRight它什么都不做。

我现在使用的代码:

new Row(
  crossAxisAlignment: CrossAxisAlignment.center,
  mainAxisAlignment: MainAxisAlignment.end,
  children: <Widget>[
    new FlatButton(
          onPressed: _navigateToPreparationStepsWidgetClicked,
          child: new Row(
            children: <Widget>[
              new Text(
                'View Preparation Steps'.toUpperCase(),
                style: new TextStyle(
                    fontWeight: FontWeight.bold),
              ),
              new Icon(Icons.keyboard_arrow_right)
            ],
          ))
  ],
)
Run Code Online (Sandbox Code Playgroud)

Button在例如 a 中对齐例如 a 的正确方法是Column什么?

alignment dart flutter

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