I have a code like this:
return Scaffold(
backgroundColor: const Color.fromARGB(255, 25, 25, 25),
body: Padding(
padding: EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Güvenli ve Gizli", style: TextStyle(fontSize: 32, color: Colors.white, fontWeight: FontWeight.bold)),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
AnimatedBuilder(
animation: ezAnimation,
builder: (context, snapshot) {
return Center(
child: Image.asset("assets/SecureAndHiddenIcon.png", fit: BoxFit.cover, color: Colors.white, height: 200)
);
}
),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Center(child: Text("Kullanıcıya değer vermek, güvenlik ve gizliliği sağlamaktan başlar. Malum tarayıcılar gibi bilgilerinizi satmayız!", style: TextStyle(fontSize: 18, color: Colors.white))), // !!!!!!!!!!!!! <<<<<<<<<<<<<<<
],
),
),
);
"Kullanıcıya değer vermek, güvenlik ve gizliliği sağlamaktan başlar. Malum tarayıcılar gibi bilgilerinizi satmayız!" written Text
is not centered even though it is inside the Center
widget. Why does this problem occur? How to I solve it?
CodePudding user response:
Hey did you try textAlign property of Text widget like this - textAlign: TextAlign.center
return Scaffold(
backgroundColor: const Color.fromARGB(255, 25, 25, 25),
body: Padding(
padding: EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Güvenli ve Gizli", style: TextStyle(fontSize: 32, color: Colors.white, fontWeight: FontWeight.bold)),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
AnimatedBuilder(
animation: ezAnimation,
builder: (context, snapshot) {
return Center(
child: Image.asset("assets/SecureAndHiddenIcon.png", fit: BoxFit.cover, color: Colors.white, height: 200)
);
}
),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Center(child: Text("Kullanıcıya değer vermek, güvenlik ve gizliliği sağlamaktan başlar. Malum tarayıcılar gibi bilgilerinizi satmayız!",textAlign: TextAlign.center, style: TextStyle(fontSize: 18, color: Colors.white))), // !!!!!!!!!!!!! <<<<<<<<<<<<<<<
],
),
),
);
CodePudding user response:
Please try using Alignment widget