Reputation: 413
I'm creating a simple flutter application.
I have a problem on how do I put text before the value got called form the api
this is the output that I want to achieve
Hello, $username
Tittle : $adsTitle
****
Hello, Jack
Tittle : Make A wish
Profile profile = snapshot.data[index];
return Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget> [
Padding(
padding: const EdgeInsets.all(8.0),
child: Center(child:user == null ? Text('') : Text((user), style:
TextStyle(fontSize: 30) )),
Center(
child: Text('${profile.adsTitle}', style: TextStyle(fontSize: 25, color:
mainColor),
),
),
),
],
),
),
);
How do I put text Hello
at the child: Center(child:user == null ? Text('') : Text((user), style: TextStyle(fontSize: 30))),
and Tittle
at the Center(child: Text('${profile.adsTitle}', style: TextStyle(fontSize: 25, color: mainColor),),),
Upvotes: 0
Views: 472
Reputation: 2097
You can use string interpolation
e.g.
Text("Hello $user")
or
Text('Title ${profile.adsTitle}')
You can also use RichText widget for that.
Upvotes: 1