For some reason, Text Widget doesn't work in my new view
I have a named navigation from the MaterialApp:
routes: <String, WidgetBuilder>
'/home': (BuildContext context) => Home(),
'/recipes': (BuildContext context) => const Recetas(),
Everything is good in the home page, but the Text Widget doesn't render any text in my App
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
import 'package:naturale_app/constraits.dart';
class Recetas extends StatelessWidget {
const Recetas({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: kSecondaryColor,
appBar: AppBar(
backgroundColor: kPrimaryColor,
title: const Text("Recetas"),
),
body: Center(
child: Container(
decoration: BoxDecoration(
color: kWhiteColor,
borderRadius: BorderRadius.circular(10),
),
child: const Text( // This doesn't Render
"Recetas",
style: TextStyle(
color: kBlackColor,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
),
),
);
}
}
I have this: Recetas Views
CodePudding user response:
I think it will be your text color issue, both background and text having the same color, check your kBlackColor
color.
child: Container(
decoration: BoxDecoration(
color: kWhiteColor, //here
borderRadius: BorderRadius.circular(10),
),
child: const Text(
"Recetas",
style: TextStyle(
color: kBlackColor, //and here the same as bg on color decleration,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
),
Change the text color to black or something
style: TextStyle(
color: Colors.black,