[英]How to remove border radius from TextButton flutter
I'm new to flutter, and I'm having this problem where my TextButton
has a little border radius.我是 flutter 的新手,我遇到了这个问题,我的TextButton
的边框半径很小。 Does anyone know how to remove the border radius from a TextButton
?有谁知道如何从TextButton
中删除边框半径?
My output我的输出
My Code sorry for not including earlier My Code我的代码很抱歉没有包括更早的我的代码
Try with this and you need to use border-radius in container.试试这个,你需要在容器中使用 border-radius 。
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "ListView.builder",
theme: new ThemeData(
primarySwatch: Colors.green
),
debugShowCheckedModeBanner: false,
home: new ListViewBuilder()
);
}
}
class ListViewBuilder extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title:Text("ListView.builder")
),
body: ListView.builder(
itemCount: 15,
itemBuilder: (BuildContext context,int index){
return TextButton(
child: Container(
width: double.infinity,
height: 205,
color: Colors.primaries[Random().nextInt(Colors.primaries.length)],
),
);
}
),
);
}
}
output:输出:
You can add a shape parameter to your TextButton您可以向TextButton添加形状参数
TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.yellow,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.zero))),
child: const Text("BUtton"),
onPressed: () {},
)
add this line of code to your TextButton()将这行代码添加到您的 TextButton()
style: TextButton.styleFrom(
shape: const BeveledRectangleBorder(borderRadius: BorderRadius.zero),
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.