I was trying to change the color of my text after I changed the color of the container. I did this but I did this but I got an error as below:
"No named parameter with the name 'color'.
style: TextStyle(fontSize: 50.0),color: Colors.white),
"
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Stack(
children: [
Container(
//width: double.infinity,
color: Colors.grey[900],
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(
//height: 150,
// width: 150,
child: Image.asset('assets/images/logo.png'),
),
const Spacer(),
const Text(
"Escorts",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const SizedBox(
width: 32,
),
const Text(
"Angenturen & Clubs",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const SizedBox(
width: 32,
),
const Text(
"Inserieren",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const SizedBox(
width: 32,
),
const Text(
"Werben",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const SizedBox(
width: 32,
),
const Text(
"Blog",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const SizedBox(
width: 32,
),
const Text(
"Kontakt",
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
),
const Spacer(),
const Icon(
Icons.attach_money,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.chat,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.person,
color: Colors.white,
),
const SizedBox(
width: 20,
),
const Icon(
Icons.search,
color: Colors.white,
),
const SizedBox(
width: 32,
),
],
),
),
],
),
Container(
color: Colors.grey[900],
child: Row(
children: const [
SizedBox(
width: 40,
),
Text("Inserieren",
style: TextStyle(fontSize: 50.0),color: Colors.white),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
SizedBox(
width: 40.0,
),
Text("Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et\n quasi architecto beatae vitae dicta sunt explicabo. \n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.\n Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet,\n consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.\n Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?\n Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,\n vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
maxLines: 20, style: TextStyle(backgroundColor: Colors.amber,),)
],
),
Container(
color: Colors.amber,
child: Row(
children: const [
SizedBox(
width: 30.0,
),
Text("tekst")
],
),
)
],
)
);
}
}
CodePudding user response:
Put color
inside TextStyle()
Text('Inseieren', style: TextStyle(fontSize: 50, color: Colors.white),)
CodePudding user response:
you need to put color inside TextStyle
CodePudding user response:
you are calling color
out of textStyle
, try this:
Text('Inseieren', style: TextStyle(fontSize: 50, color: Colors.white),)
For your long text you can wrap it with Expanded
widget, like this:
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
SizedBox(
width: 40.0,
),
Expanded(
child: Text(
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et\n quasi architecto beatae vitae dicta sunt explicabo. \n Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.\n Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet,\n consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.\n Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?\n Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur,\n vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
maxLines: 20,
style: TextStyle(
backgroundColor: Colors.amber,
),
),
)
],
),