小编KUN*_*ANI的帖子

Flutter-如何在一行中的特定位置对齐按钮?

我在屏幕底部的一行中有两个按钮。我想将第一个按钮保留在中间,第二个按钮保留在末尾。我怎样才能做到这一点?

在此输入图像描述

这是我的代码

 new Container
                (
                  child:Row(
                    children:<Widget>[




                    new RaisedButton(
                      color: Colors.red,
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(10)),
                      onPressed: takescrshot,
                      child: Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Text(
                          'Next',
                          style:
                          TextStyle(fontSize: 23, color: Colors.white),
                        ),
                      ),
                    ),

                     new FloatingActionButton.extended(
                        onPressed: () {
                          // Add your onPressed code here!
                        },
                        label: Text('options'),
                        icon: Icon(Icons.menu),
                        backgroundColor: Colors.pink,
                      ),
              ])
        )
Run Code Online (Sandbox Code Playgroud)

有人可以指导我吗?

button dart flutter flutter-layout

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

Flutter - 如何将 List&lt;Uint8List&gt; 放入共享首选项?

我有一个Unit8List列表,它存储多个图像的数据。我想与其他活动共享该列表,以便其他活动可以使用该列表来显示图像。那么我如何使用SharedPreferences进行共享?或者有什么方法可以用来传递具有 Unit8List 对象的列表?

list sharedpreferences dart flutter uint8list

4
推荐指数
2
解决办法
1904
查看次数

如何从颤动中的图像中获取主色?

我想从图像中提取主色,以便我可以将其应用为混合到其他图像。我怎样才能做到这一点?

在我当前的代码中,我手动给出了颜色,但我希望它由应用程序生成。

class MyApp extends StatelessWidget {

  Color face = new HexColor("a8a8a8");
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Image from assets"),
        ),
        body: Column (
            mainAxisAlignment: MainAxisAlignment.center,
              children:<Widget>[
                Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children:<Widget>[
                      new Image.asset('assets/images/6.jpg',
                        color: face, colorBlendMode:BlendMode.modulate ,
                        fit:BoxFit.cover,
                        height: 50,
                        width: 50,
                      ),


                new Image.asset('assets/images/1.jpg',
              color: face, colorBlendMode: BlendMode.modulate,
            fit:BoxFit.cover,
                  height: 200,
                  width: 200,
          ),
                    ]),
                ])),
    );
  }
}


Run Code Online (Sandbox Code Playgroud)

image colors color-palette dart flutter

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

Flutter-按下后退按钮时如何重定向到特定活动?

我想在按下后退按钮时我当前的 flutter 页面重定向到主页。当我按下后退按钮时,主页/活动应该开始。我在主页和当前页面中有多个选择,如果用户不想选择他们可以按回进入主页,我会显示眼睛。

这是我当前页面/活动的代码



import '../DataFetching/face_part.dart';
import 'package:flutter/material.dart';




class EyesFetch extends StatelessWidget {


  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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