Created
June 9, 2020 03:55
-
-
Save ha-yi/62747638af316176165b79b27fbba2c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
extension StringExt on String { | |
Text toH2(context) { | |
return Text(this, style: Theme.of(context).textTheme.headline2,); | |
} | |
} | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Center( | |
child: Column( | |
children: [ | |
'Hello World'.toH2(context), | |
'Hello 2'.toH2(context) | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment