小编Hai*_*ana的帖子

Dart - 如何在字符串中插入“$”字样?

我目前正在使用 flutter(Dart) 创建一个简单的应用程序。当我想创建 AppBar 小部件时,我不能用“$”给它命名。因为,就像 Kotlin..Dart 一样,使用 '$' 来调用标识符。

有什么解决办法吗?

var _appbar = AppBar(
  title: Text("How I Made $100"), //$ is the error
);
Run Code Online (Sandbox Code Playgroud)

dart android-studio flutter

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

颤振-底部溢出119个像素

在ListView中创建图像时出现错误“ 底部溢出199像素 ”,在我用Google搜索之后,所有这些都建议我添加:

resizeToAvoidBottomPadding: false
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用!错误仍然存​​在。

在此处输入图片说明

SafeArea小部件也无法解决问题。这是我的布局的简短代码版本:

body: ListView(
         children:<Widget> [
           new Container(
             child: new Stack(
               children:<Widget> [
                 //THE WIDGET
                 new Container(), //THE BACKGROND IMAGE
                 new Positioned(
                   child: Column(
                     children:<Widget>[
                         new Transform(),
                         new FadeTransition(),
                         new FadeTransition(),
                         Divider(),
                         new Row(),
                         //THE IMAGE THAT I WANT TO ADD
                         new Container(
                           height: 360.0
                           decoration: BoxDecoration(
                            image: DecorationImage(
                               image: Assetimage('lake.jpg)
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

Flutter - 如何制作 PageView 和 ListView?

我正在尝试使用 PageView、PageController 和 ListView 制作一个旋转木马,来自这张水平可滚动的卡片,在 flutter 中具有 Snap 效果。但它抛出了这个异常......

???通过渲染库捕获的异常 ????????????????????????????????????????????? ???????????? I/flutter (17678):在 performResize() 期间抛出以下断言: I/flutter (17678):水平视口被赋予无限高度。I/flutter (17678):视口在横轴上扩展以填充其容器并约束其子项以匹配 I/flutter (17678):它们在横轴上的范围。在这种情况下,水平视口被赋予无限量的 I/flutter (17678):可扩展的垂直空间。

有人可以帮我修复它吗?

我想在 Stack-filled 内添加这个 Carousel,里面有背景图像、变换类和淡入淡出过渡。

  @override
  void initState() {
   super.initState();
    controller = PageController(
     initialPage: 0,
     keepPage: true,
    );

 @override
  Widget build(BuildContext context) {

    return AnimatedBuilder(
        builder: (BuildContext context, Widget child) {
         return Scaffold(
           //BODY
          body: ListView(children: <Widget>[
            new Stack(
              children: <Widget>[
                new AspectRatio(...),
                new Transform(...),
                //THIS IS
                new ListView.builder(
                  itemCount: 3,
                  scrollDirection: Axis.horizontal,
                  padding: EdgeInsets.symmetric(vertical: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

Flutter-如何自动启用AnimatedOpacity?

我正在创建一个仪表板,其中包含两个小部件(文本和两个容器)的Tween动画。但是,我想使两个Container的不透明度从不可见变为缓慢...因此我使用了AnimatedOpacity。但是我不知道该怎么做...

任何帮助,将不胜感激..

class _IntroState extends State<Intro> with SingleTickerProviderStateMixin {
  Animation animation;
  AnimationController animationController;

   @override
   void initState() {
     super.initState();
      animationController = AnimationController(
        duration: Duration(seconds: 2),
        vsync: this,
     );

    animation = Tween(begin: -1.0, end: 0.0).animate(CurvedAnimation(
        parent: animationController, curve: Curves.fastOutSlowIn));
    animationController.forward();
  }

  @override
  Widget build(BuildContext context) {
    bool _visible = false;
    final double width = MediaQuery.of(context).size.width;

  return AnimatedBuilder(
      animation: animationController,
      builder: (BuildContext context, Widget child) {
         return Scaffold(
           //BODDY
            body: ListView(
              hildren:<Widget>[
                 new Stack(
                   children: <Widget>[
                     new Transform(
                       //ANIMATED OPACITY
                       new AnimatedOpacity(
                          opacity: …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-animation

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

标签 统计

dart ×4

flutter ×4

android-studio ×1

flutter-animation ×1