Flutter 没有像 Apple Pay 这样的按钮,也没有任何苹果图标。
所以,你可以在这里做两件事 ->
-
添加“Apple”的自定义图标
-
添加“Apple”图像而不是图标(我想你知道这一点)
[如果您不知道如何添加图片,请告诉我]
然后你可以创建这样的按钮...
-
访问this site,搜索苹果并选择“Apple logo”而不是“Apple Pay logo”,
将文件名从“MyFlutterApp”更改为“自定义”并下载,
解压文件,将 dart 文件添加到您的 lib 文件夹中
还有(资产或字体文件夹或您想要的任何地方)中的 Custom.ttf 文件
并将其添加到 pubspec.yaml 中的字体部分,如代码所示
代码如下:
//pubspec.yaml ->
fonts:
- family: Custom
fonts:
- assets/Custom.ttf //path of Custom.ttf in you project
//Dart file where you will add Apple pay button
import'custom_icons.dart' as CustomIcon;//custom_icons.dart is one of the downloaded file
//THIS IS THE NORMAL WAY TO CREATE A BUTTON
RaisedButton(
color: Colors.black,
onPressed: (){
//ADD THE FUNCTIONS OF THIS BUTTON HERE
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(CustomIcon.Custom.apple, color: Colors.white,),
SizedBox(width: 8.0,),
Text('Apple Pay', style: TextStyle(color: Colors.white),)
],
),
),
//USE THIS FOR CUSTOMISING YOUR BUTTON
Container(
height: 30.0,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
color: Colors.black
),
child: GestureDetector(
onTap: (){
//ADD THE FUNCTIONS OF THIS BUTTON HERE
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(CustomIcon.Custom.apple, color: Colors.white,),
SizedBox(width: 8.0,),
Text('Apple Pay', style: TextStyle(color: Colors.white),)
],
),
),
),