Created
October 5, 2023 07:27
-
-
Save k4zek4ge/855e50df49b499c916e1c8fae508fd88 to your computer and use it in GitHub Desktop.
[stick row to bottom] #flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Stick Row to Bottom', | |
theme: ThemeData(primarySwatch: Colors.blue), | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
double screenWidth = MediaQuery.of(context).size.width; | |
return Scaffold( | |
appBar: AppBar(title: const Text('Stick Row to Bottom')), | |
body: Column( | |
children: [ | |
Expanded( | |
child: SingleChildScrollView( | |
child: Container( | |
color: Colors.white10, | |
width: screenWidth, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, // to ensure children take full width | |
children: [ | |
// Your content here | |
for (var i = 0; i < 50; i++) Text('Content $i'), | |
], | |
), | |
), | |
), | |
), | |
// This Row will stick to the bottom | |
Container( | |
width: screenWidth, | |
color: Colors.blue.shade100, | |
child: const Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, // to spread the row items | |
children: [ | |
Text('This is a row'), | |
Icon(Icons.arrow_forward), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment