Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android appbar上的颤振定位超链接_Android_Flutter_Dart_Flutter Layout - Fatal编程技术网

Android appbar上的颤振定位超链接

Android appbar上的颤振定位超链接,android,flutter,dart,flutter-layout,Android,Flutter,Dart,Flutter Layout,是否可以在appbar上定位使用url_启动器创建的超链接?这里有一个屏幕,我的意思是“SITOWEB”是一个超链接,我想改变位置,需要在红色的圆环中移动它。这是我的应用程序栏 class BackgroundImage extends StatelessWidget{ final Widget body; BackgroundImage({this.body}); @override Widget build(BuildContext context){ r

是否可以在appbar上定位使用url_启动器创建的超链接?这里有一个屏幕,我的意思是“SITOWEB”是一个超链接,我想改变位置,需要在红色的圆环中移动它。这是我的应用程序栏

class BackgroundImage extends StatelessWidget{
  final Widget body;
  BackgroundImage({this.body});
    @override
    Widget build(BuildContext context){
      return Scaffold(
        appBar: AppBar(
          elevation: 0,
          title: Text('Blumax', style: TextStyle(
            fontWeight: FontWeight.w500,
            fontFamily: 'DancingScript',
            fontSize: 40
          ),),
          centerTitle: false,
        ),
        body: Stack(
          children: <Widget>[Container(
          decoration: BoxDecoration(
            image: DecorationImage(image: AssetImage("assets/whiteimage.jpg"), fit: BoxFit.cover),
          ),
        ),
          body
        ]
      )
    );
  }
}

在AppBar中尝试
actions
,您可以使用
FlatButton
Inkwell
或任何在其内部提供触摸事件的小部件

appBar: AppBar(
        title: Text(Lang.treeView),
        actions: <Widget>[
      InkWell(
      child: Container(
          alignment: Alignment(0.9, -1.0),
        child: Text(
          "ABC",
          textAlign: TextAlign.right,
          style: TextStyle(
              fontFamily: 'RobotoMono',
              fontSize: 20,
              color: Colors.white,
              decoration: TextDecoration.underline),
        ))),
        ],
      )
appBar:appBar(
标题:文本(Lang.treeView),
行动:[
墨水池(
子:容器(
对齐:对齐(0.9,-1.0),
子:文本(
“ABC”,
textAlign:textAlign.right,
样式:TextStyle(
fontFamily:“RobotoMono”,
尺寸:20,
颜色:颜色,白色,
装饰:文本装饰。下划线),
))),
],
)

@andrea,您不需要使用墨水池/容器。您可以使用appBar中带有简单按钮的操作,并尝试以下操作:

class MyAppState extends State<MyApp> {
  String _text = 'Link';
  String _url = 'https://www.test.com';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: Text('Test'),
                actions: <Widget>[
                  FlatButton(
                    child: Text(_text, style: TextStyle(fontSize: 18.0, color: Colors.white)),
                    onPressed: _launchURL,
                  ),
                  IconButton(icon: Icon(Icons.more_vert, color: Colors.white), onPressed: (){})
                ]
            ),
            body: Padding(
                  padding: EdgeInsets.all(20.0),
                  child: Center(
                    child: Text('')
                  )
                  )
            )
            );
  }

  _launchURL() async {
    if (await canLaunch(_url)) {
      await launch(_url);
    } else {
      throw 'Could not launch $_url';
    }
  }
}
类MyAppState扩展了状态{
字符串_text='Link';
字符串https://www.test.com';
@凌驾
小部件构建(构建上下文){
返回材料PP(
家:脚手架(
appBar:appBar(
标题:文本(“测试”),
行动:[
扁平按钮(
子项:文本(_Text,style:TextStyle(fontSize:18.0,颜色:Colors.white)),
onPressed:_launchURL,
),
图标按钮(图标:图标(Icons.more\u vert,颜色:Colors.white),ON按下:(){})
]
),
主体:填充物(
填充:所有边缘设置(20.0),
儿童:中心(
子项:文本(“”)
)
)
)
);
}
_启动URL()异步{
如果(等待canLaunch(_url)){
等待启动(_url);
}否则{
抛出“无法启动$_url”;
}
}
}

class MyAppState extends State<MyApp> {
  String _text = 'Link';
  String _url = 'https://www.test.com';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: Text('Test'),
                actions: <Widget>[
                  FlatButton(
                    child: Text(_text, style: TextStyle(fontSize: 18.0, color: Colors.white)),
                    onPressed: _launchURL,
                  ),
                  IconButton(icon: Icon(Icons.more_vert, color: Colors.white), onPressed: (){})
                ]
            ),
            body: Padding(
                  padding: EdgeInsets.all(20.0),
                  child: Center(
                    child: Text('')
                  )
                  )
            )
            );
  }

  _launchURL() async {
    if (await canLaunch(_url)) {
      await launch(_url);
    } else {
      throw 'Could not launch $_url';
    }
  }
}