如何更改我的文本在右上角的位置?我尝试使用“ text.Align”,但我认为是为了对齐文本,并且不更改位置...我尝试放置“ new Align”,但没有结果,我尝试从主文件更改,但是什么也没有,我找不到合适的属性...这是我的main.dart
import 'package:flutter/material.dart';
import 'hyperlink.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Test',
theme: ThemeData(
brightness: Brightness.dark
),
home: Scaffold(
body: Center(
child: Hyperlink('www.test.com', 'test'),
),
)
);
}
}
和这里是我的超链接。dart
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class Hyperlink extends StatelessWidget {
final String _url;
final String _text;
Hyperlink(this._url, this._text);
_launchURL() async {
if (await canLaunch(_url)) {
await launch(_url);
} else {
throw 'Could not launch $_url';
}
}
@override
Widget build(BuildContext context) {
return InkWell(
child: Text(_text,
textAlign: TextAlign.right,
style: TextStyle(
color: Colors.white,
decoration: TextDecoration.underline),
),
onTap: _launchURL,
);
}
}
答案 0 :(得分:0)