Flutter 添加六种颜色,而不是Fluter默认颜色值
我想使用backgroundColor:Colors在我的颤振应用程序中使用hexa颜色代码。#34A123。但我只能拍摄颤振默认值Flutter 添加六种颜色,而不是Fluter默认颜色值,flutter,Flutter,我想使用backgroundColor:Colors在我的颤振应用程序中使用hexa颜色代码。#34A123。但我只能拍摄颤振默认值 @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('CRICKDOM MOBILE'), backgroundColor: Colors.blue, lea
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('CRICKDOM MOBILE'),
backgroundColor: Colors.blue,
leading:IconButton(
icon: Icon(
Icons.menu
),
onPressed: (){},
),
],
);
}
}
``
您必须使用类的构造函数之一 如果您有RGB值,则可以使用:
Color c = const Color.fromRGBO(66, 165, 245, 1.0);
如果您有十六进制,那么您可以使用默认构造函数,即#ABCDEF使用
Color myColor = const Color(0xFFABCDEF);
请注意,前两个FF是alpha通道透明度。FF表示完全可见。如果省略它们,您的颜色将是完全透明的。背景颜色:颜色。#A231B3,不起作用这是否回答了您的问题?