In the application I developed with Flutter, I want to put a Text
widget at the bottom of the page.
My codes:
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:teen_software_stock_tracking_app/Controller/PaginationController.dart';
FirebaseAuth _auth = FirebaseAuth.instance;
FirebaseFirestore _store = FirebaseFirestore.instance;
PaginationController paginationController = PaginationController();
TextEditingController _emailController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
FocusNode _passwordFocus = FocusNode();
bool SeePassword = true;
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
void initState() {
super.initState();
_passwordFocus = FocusNode();
}
@override
void dispose() {
_passwordFocus.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
physics: const NeverScrollableScrollPhysics(),
child: Container(
width: double.infinity,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 14, 108, 184),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 60),
Padding(
padding: const EdgeInsets.all(20),
child: Column (
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text("Giriş yap", style: TextStyle(color: Colors.white, fontSize: 40, fontFamily: "Roboto Bold")),
SizedBox(height: 12),
Text("Hoş geldiniz.", style: TextStyle(color: Colors.white, fontSize: 22, fontFamily: "Roboto Regular")),
],
),
),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(60),
topRight: Radius.circular(60),
),
),
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
Center(
child: Container(
width: 70,
height: 5,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 185, 185, 185),
borderRadius: BorderRadius.circular(15),
),
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.080),
const Text("E-posta:", style: TextStyle(fontSize: 21, color: Color.fromARGB(255, 34, 34, 34), fontFamily: "Roboto Medium")),
SizedBox(height: MediaQuery.of(context).size.height * 0.010),
Theme(
data:Theme.of(context).copyWith(
colorScheme: ThemeData().colorScheme.copyWith(
primary: const Color.fromARGB(255, 13, 117, 203),
),
),
child: TextFormField(
controller: _emailController,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
filled: true,
fillColor: const Color.fromARGB(255, 232, 232, 232),
contentPadding: const EdgeInsets.symmetric(vertical: 15),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
),
prefixIcon: const Icon(Icons.email),
),
style: const TextStyle(fontSize: 20, fontFamily: "Roboto Regular"),
onFieldSubmitted: (value) {
_passwordFocus.requestFocus();
},
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.027),
Row(
children: [
const Text("Parola:", style: TextStyle(fontSize: 21, color: Color.fromARGB(255, 34, 34, 34), fontFamily: "Roboto Medium")),
const Spacer(),
GestureDetector(
child: const Text("Şifremi unuttum", style: TextStyle(fontSize: 19, color: Color.fromARGB(255, 14, 108, 184), fontFamily: "Roboto Bold")),
onTap: () {
// send email of reset.
},
),
],
),
SizedBox(height: MediaQuery.of(context).size.height * 0.010),
Theme(
data:Theme.of(context).copyWith(
colorScheme: ThemeData().colorScheme.copyWith(
primary: const Color.fromARGB(255, 13, 117, 203),
),
),
child: TextFormField(
controller: _passwordController,
focusNode: _passwordFocus,
keyboardType: TextInputType.visiblePassword,
obscureText: SeePassword,
decoration: InputDecoration(
filled: true,
fillColor: const Color.fromARGB(255, 232, 232, 232),
contentPadding: const EdgeInsets.symmetric(vertical: 15),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
),
prefixIcon: const Icon(Icons.lock, size: 20),
suffixIcon: GestureDetector(
child: SeePassword ? const Icon(Icons.remove_red_eye) : const Icon(Icons.highlight_off_sharp),
onTap: () {
setState(() {
SeePassword = !SeePassword;
});
},
),
),
style: const TextStyle(fontSize: 20, fontFamily: "Roboto Regular"),
),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.030),
Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
backgroundColor: const Color.fromARGB(255, 13, 117, 203),
),
child: const Text("Giriş yap", style: TextStyle(color: Colors.white, fontSize: 20, fontFamily: "Roboto Bold")),
onPressed: () {},
),
),
),
],
),
),
),
),
],
),
),
)
);
}
}
And app:
I want to put a Text
at the bottom of the page. I tried with Align but got many errors. That's why I'm opening this thread. Additionally, I tried doing it with Spacer()
and it still didn't work.
How can I do what I want? Could you help? I appreciate your help in advance.
CodePudding user response:
Wrap your body in a Stack and add the code:
Align(
alignment: Alignment.bottomCenter,
child: Text('yourText'),
),
Do not forget to adapt your body with the Stack widget.
CodePudding user response:
you can wrap your Text around Expanded widget and the adjust it
Expanded(
child: .../ your Text widget
)