【问题标题】:how can I build Widgets using flutter?如何使用颤振构建小部件?
【发布时间】:2020-05-30 04:11:53
【问题描述】:

View screen shot here

我需要为我的颤振应用程序构建这种小部件。小部件应该可以跨越屏幕。有可能吗?那我该怎么做呢? 提前致谢!

【问题讨论】:

标签: android flutter


【解决方案1】:
import 'package:flutter/material.dart';

    void main() {
        runApp(MyApp());
    }

    class MyApp extends StatelessWidget {

    @override
    Widget build(BuildContext context) {

    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
            title: Text(“First Widgets")),
        body: myWidget(),
        ),  
        );
      }
    }

    Widget myWidget() {
      return Text(
        "Hello, World!",
      );
    }
}

【讨论】:

    【解决方案2】:

    实际上,Flutter 无法创建这种类型的小部件(您可以在主屏幕上添加的小部件),因为 Flutter 使用自己的自定义渲染引擎。

    【讨论】:

      猜你喜欢
      • 2020-09-07
      • 2023-03-07
      • 1970-01-01
      • 2019-12-27
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 2021-03-18
      • 2022-01-25
      相关资源
      最近更新 更多