How to get simple text on screen without Scafflod in Flutter?
You can wrap the text inside "Material" widget. Also, using "style:" parameter fixes the problem.
Material( color: Colors.transparent, child: Text( "Your Text Here", style: TextStyle( fontFamily: 'custom font', // remove this if don't have custom font fontSize: 20.0, // text size color: Colors.white, // text color ), ), )
Scaffold
is setting the basic material design visual layout structure, which much include default text styles, etc. If you don't want to use Scaffold
for whatever reason, then you can apply the relevant text styles and colours from the current theme using Theme.of(context)
. For example:
Text( 'You have pushed the button this many times:', style: Theme.of(context).primaryTextTheme.headline, textAlign: TextAlign.center,),
Text( 'Sign in / Sign up with', style: TextStyle( fontFamily: appFontFamily, fontSize: 20, decoration: TextDecoration.none,////set decoration to .none fontWeight: FontWeight.bold, color: defaultTitleColor, ),)