main.dart
import 'package:flutter/material.dart';
void main(){
var txt = "i am a text.";
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text(
"Flutter - Text Capitalize First Letter"
)
),
body: Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(8),
child: Text(
"${txt[0].toUpperCase()}${txt.substring(1)}",
style: const TextStyle(fontSize: 50)
)
),
),
)
);
}
More flutter tutorials
- flutter – Text overflow ellipsis
- flutter – Text uppercase
- flutter – ElevatedButton onPressed
- flutter – How to add padding to ElevatedButton
- flutter – MaterialStateProperty padding
- flutter – MaterialStateProperty color
- flutter – How to change ElevatedButton border color
- flutter – How to create TextButton rounded border
- flutter – TextButton border radius only
- flutter – How to create a circular TextButton
- flutter – How to remove IconButton padding
- flutter – IconButton remove splash
- flutter – How to disable an IconButton
- flutter – Random material color
- flutter – Random material color with shade