I am confused what the width of the slider widget is: I have a stack and added an align widget that contains a slider.
Code: import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: OptionsBar(),
),
],
),
),
);
}
}
class OptionsBar extends StatefulWidget {
const OptionsBar({Key? key}) : super(key: key);
@override
_OptionsBarState createState() => _OptionsBarState();
}
class _OptionsBarState extends State<OptionsBar> {
double progress = 0.0;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(10),
child: Row(
children: [
Slider(
value: progress,
onChanged: (double newValue) => setState(() => progress = newValue),
)
],
),
);
}
}
The code works but places the slider in the middle of the screen. However, if I give the widget that contains the slider a height than the bar remains at the bottom. So, does that mean that a slider takes up the entire height that it can get? Seems a little bit strange or am I getting something wrong?