Skip to content

1.Text

在這個地方你必須學會

  • Flutter文字設定及程式碼編寫
請自行手打以下程式碼
import "package:flutter/material.dart";

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({
    super.key,
  });
  final Color accentColor = Colors.green;
  @override
  Widget build(BuildContext context) {
    return Center(
        child: Text(
      "Hello World",
      textDirection: TextDirection.ltr,
      style: TextStyle(
        //顏色
        color: accentColor,
        //大小
        fontSize: 30,
        //粗體
        fontWeight: FontWeight.w500,
        //斜體
        fontStyle: FontStyle.italic,
        //字間距
        letterSpacing: 5.0,
        //單辭間距
        wordSpacing: 5.0,
        height: 2,
        shadows: [
          Shadow(color: Colors.white, offset: Offset(2, 2), blurRadius: 3)
        ],
        background: Paint()..color = Color.fromARGB(255, 200, 230, 249),
      ),
    ));
  }
}

Last update : 13 novembre 2024
Created : 13 novembre 2024

Comments

Comments