We all have seen LineThrough text Looks like 5$ in many web apps and mobile apps. The main purpose of StrikeThrough text is to show discounted price of a item. In flutter to create StrikeThrough text we have to use TextDecoration.lineThrough .
Flutter Create StrikeThrough Text - LineThrough:
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text(
'StrikeThrough Text in Flutter',
style: TextStyle(
fontSize: 34,
decoration: TextDecoration.lineThrough,
decorationColor: Colors.red,
decorationThickness: 1.8,
),
))),
);
}
}
Screenshot:
Comments
Post a Comment