Flutter Login Screen UI Scrollable - flutter

I'm trying to make a login screen in Flutter. This login contains fields like e-mail and password, forgot password, sign up. The problem is in some devices the keyboard hides the password filed, I want to make the screen scroll.
My code looks like:
return Scaffold(
key: _scaffoldKey,
resizeToAvoidBottomPadding: false,
body: Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new ExactAssetImage("graphics/register_bg.png"),
fit: BoxFit.cover,
),
),
child: LoadingIndicatorPage(
loading: _loading,
child: Padding(
padding: EdgeInsets.only(
left: LEFTRIGHT_PADDING, right: LEFTRIGHT_PADDING),
child: AnimatedOpacity(
opacity: _currentOpacity,
duration: const Duration(seconds: 1),
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 90),
child: Text(
AppLocalizations.of(context).loginTitle,
style: TextStyle(fontSize: 32),
),
),
Padding(
padding: EdgeInsets.only(top: 90),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
AppLocalizations.of(context).loginEmailHint,
style: TextStyle(color: brownishGrey),
),
),
),
TextFieldInput(
inputType: TextInputType.emailAddress,
textEditingController: emailController,
),
Padding(
padding: EdgeInsets.only(top: INPUT_FIELDS_SPACING),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
AppLocalizations.of(context).loginPasswordHint,
style: TextStyle(color: brownishGrey),
),
),
),
TextFieldInput(
inputType: TextInputType.text,
textEditingController: passwordController,
obscureText: true,
),
Padding(
padding:
EdgeInsets.only(top: PAGE_TOP_NO_TITLE_PADDING),
child: Align(
alignment: Alignment.centerLeft,
child: GestureDetector(
onTap: () {
_showForgotPassword();
},
child: Text(
AppLocalizations.of(context)
.loginForgotPassword +
'?',
style: TextStyle(color: purpleishBlueThree),
),
),
),
),
],
),
),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Button(
text: AppLocalizations.of(context).loginLogin,
buttonOnPressed: () {
_login();
},
),
),
Padding(
padding: const EdgeInsets.fromLTRB(8.0, 15.0, 8.0, 0),
child: Divider(
thickness: 1,
color: whiteTwo,
),
),
Padding(
padding: EdgeInsets.only(top: 15.0, bottom: 15.0),
child: GestureDetector(
child: RichText(
text: TextSpan(
text: AppLocalizations.of(context)
.loginCreateAccountPre,
style: TextStyle(color: brownishGrey),
children: <TextSpan>[
TextSpan(
text: AppLocalizations.of(context)
.loginCreateAccountPost,
style: TextStyle(
color: purpleishBlueThree,
decoration: TextDecoration.underline,
),
)
],
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => new RegisterPage(),
),
);
},
),
),
],
),
),
),
),
),
);

Try wrapping your body: Container with SingleChildScrollView
and remove the resizeToAvoidBottomPadding from the Scaffold

Wrap LoadingIndicatorPage inside SingleChildScrollView
return Scaffold(
key: _scaffoldKey,
body: Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new ExactAssetImage("graphics/register_bg.png"),
fit: BoxFit.cover,
),
),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: LoadingIndicatorPage(
loading: _loading,
child: Padding(
padding: EdgeInsets.only(
left: LEFTRIGHT_PADDING, right: LEFTRIGHT_PADDING),
child: AnimatedOpacity(
opacity: _currentOpacity,
duration: const Duration(seconds: 1),
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 90),
child: Text(
AppLocalizations.of(context).loginTitle,
style: TextStyle(fontSize: 32),
),
),
Padding(
padding: EdgeInsets.only(top: 90),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
AppLocalizations.of(context).loginEmailHint,
style: TextStyle(color: brownishGrey),
),
),
),
TextFieldInput(
inputType: TextInputType.emailAddress,
textEditingController: emailController,
),
Padding(
padding: EdgeInsets.only(top: INPUT_FIELDS_SPACING),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
AppLocalizations.of(context).loginPasswordHint,
style: TextStyle(color: brownishGrey),
),
),
),
TextFieldInput(
inputType: TextInputType.text,
textEditingController: passwordController,
obscureText: true,
),
Padding(
padding:
EdgeInsets.only(top: PAGE_TOP_NO_TITLE_PADDING),
child: Align(
alignment: Alignment.centerLeft,
child: GestureDetector(
onTap: () {
_showForgotPassword();
},
child: Text(
AppLocalizations.of(context)
.loginForgotPassword +
'?',
style: TextStyle(color: purpleishBlueThree),
),
),
),
),
],
),
),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Button(
text: AppLocalizations.of(context).loginLogin,
buttonOnPressed: () {
_login();
},
),
),
Padding(
padding: const EdgeInsets.fromLTRB(8.0, 15.0, 8.0, 0),
child: Divider(
thickness: 1,
color: whiteTwo,
),
),
Padding(
padding: EdgeInsets.only(top: 15.0, bottom: 15.0),
child: GestureDetector(
child: RichText(
text: TextSpan(
text: AppLocalizations.of(context)
.loginCreateAccountPre,
style: TextStyle(color: brownishGrey),
children: <TextSpan>[
TextSpan(
text: AppLocalizations.of(context)
.loginCreateAccountPost,
style: TextStyle(
color: purpleishBlueThree,
decoration: TextDecoration.underline,
),
)
],
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => new RegisterPage(),
),
);
},
),
),
],
),
),
),
),
),
),
);

Related

Flutter error 'RenderAspectRatio has unbounded constraints' when row of containers are inside a wrapped Expanded column

In Flutter, I'm attempting to build rows of containers that are inside the Expanded wrapped column which is also inside a row. for some reason, it errors on 'RenderAspectRatio has unbounded constraints'. I've attempted to move the Expanded widget to different places on the code but it continues to error sometimes it will throw,
"RenderFlex children have non-zero flex but incoming height constraints are unbounded"
I've tried many things and I read many Q&A on the issues here in StackOverflow and elsewhere but to no avail, I still haven't solved the problem.
here's the code:
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
),
GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
),
GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
),
GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
),
],
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
//Expanded(
//child:
GestureDetector(
onTap: () {
print('Just clicked on 8');
},
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.cyan,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'8',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
],
),
),
],
),
],
),
),
),
);
}
I'm attempting to create something that looks like this:
I didn't get the whole idea from the image but from what I understood, I have implemented it like this.
Since there is a lot of repetition and there is a pattern, I use GridView and ListView respectively.
class NumbersGridView extends StatelessWidget {
const NumbersGridView({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 3 / 2,
crossAxisSpacing: 10,
mainAxisSpacing: 20,
),
itemCount: 30,
itemBuilder: (buildContext, index) {
return InkWell(
onTap: () {
print(index);
},
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.cyan,
margin: const EdgeInsets.all(1.0),
child: AutoSizeText(
index.toString(),
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
);
}),
),
Container(width: 20.0, child: VerticalDivider(color: Colors.red)),
Flexible(
child: SizedBox(
width: 50.0,
child: ListView.builder(
itemCount: 5,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (buildContext, index) {
return Container(
height: 40.0,
width: 40.0,
alignment: Alignment.center,
color: Colors.cyan,
child: AutoSizeText(
index.toString(),
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.black45),
),
);
}),
),
)
],
);
}
}
If you want to implement it as you originally tried, here's is the code without the specified error.
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0,
color: Colors.black45),
),
),
),
),
),
),
Expanded(
child: GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0,
color: Colors.black45),
),
),
),
),
),
),
Expanded(
child: GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0,
color: Colors.black45),
),
),
),
),
),
),
Expanded(
child: GestureDetector(
onTap: () {
print('Just clicked on 7');
},
child: Align(
alignment: Alignment.center,
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.yellow,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'7',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0,
color: Colors.black45),
),
),
),
),
),
),
],
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
//Expanded(
//child:
GestureDetector(
onTap: () {
print('Just clicked on 8');
},
child: AspectRatio(
aspectRatio: 1,
child: Container(
color: Colors.cyan,
margin: const EdgeInsets.all(1.0),
child: const AutoSizeText(
'8',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 300.0, color: Colors.black45),
),
),
),
),
],
),
),
],
)

how to see the element in emulator ui in flutter

Now I am adding a scrollbar to my app, this is my code:
final ScrollController _scrollController = ScrollController();
return GestureDetector(
onHorizontalDragStart: _onHorizontalDragStart,
onHorizontalDragUpdate: _onHorizontalDragUpdate,
onHorizontalDragEnd: _onHorizontalDragEnd,
child: Container(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.9,
),
color: Theme.of(context).scaffoldBackgroundColor,
child: CupertinoScrollbar(
isAlwaysShown: true,
controller: _scrollController,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: buildListView(item, context),
),
)));
but in the UI, I did not find the ScrollBar. How to make the scrollbar show on the UI? or like inspect element like html in Chrome. this is the UI:
I have wake up the Flutter Inspector, but when I click the element, nothing happen in the emulator. Now I am using SingleChildScrollView:
SingleChildScrollView buildListView(Item item, BuildContext context) {
return SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () => CommonUtils.launchUrl(item.link),
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Container(
child: Text(
item.title == "" ? "Comment" : item.title,
style: Theme.of(context).textTheme.headline5!.copyWith(
fontWeight: FontWeight.w600,
),
),
),
),
),
if (item.domain != "")
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: InkWell(
onTap: () async {
navToChannelDetail();
},
child: Text(
item.domain,
style: Theme.of(context).textTheme.caption!.copyWith(color: Theme.of(context).primaryColor),
)),
),
InkWell(
onTap: () {},
child: RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: item.author,
style: Theme.of(context).textTheme.caption,
),
TextSpan(
text: " ${String.fromCharCode(8226)} ",
style: Theme.of(context).textTheme.caption,
),
TextSpan(
text: item.ago,
style: Theme.of(context).textTheme.caption,
),
],
),
),
),
if (item.content != "")
Html(
data: item.content,
style: {
"body": Style(
fontSize: FontSize(19.0),
),
},
//sonLinkTap: (url) => CommonUtils.launchUrl(url),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 16.0),
child: Row(
children: [
if (item.isFav == 1)
IconButton(
icon: Icon(Icons.bookmark, color: Theme.of(context).primaryColor),
onPressed: () => touchFav("unfav", FavStatus.UNFAV),
),
if (item.isFav != 1)
IconButton(
icon: Icon(Icons.bookmark),
onPressed: () => touchFav("fav", FavStatus.FAV),
),
Padding(
padding: const EdgeInsets.only(left: 0.0),
child: Text(
"${item.favCount}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption!.copyWith(
color: Theme.of(context).primaryColor,
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 0.0),
child: Row(
children: [
if (item.isUpvote == 1)
IconButton(
icon: Icon(Icons.thumb_up, color: Theme.of(context).primaryColor),
onPressed: () => touchUpvote("unupvote", UpvoteStatus.UNUPVOTE),
),
if (item.isUpvote != 1)
IconButton(
icon: Icon(Icons.thumb_up),
onPressed: () => touchUpvote("upvote", UpvoteStatus.UPVOTE),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
"${item.upvoteCount}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.caption!.copyWith(
color: Theme.of(context).primaryColor,
),
),
),
],
),
),
],
),
IconButton(
icon: Icon(
Feather.share_2,
),
onPressed: () => handleShare(id: item.id, title: item.title, postUrl: item.link),
),
],
),
],
));
}
You must add the _scrollController to ListView
You can try this , I hope to help you :
return Container(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.9,
),
color: Theme.of(context).scaffoldBackgroundColor,
child: CupertinoScrollbar(
isAlwaysShown: true,
controller: _scrollController,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: ListView.builder(
controller: _scrollController,
itemCount: 500,
shrinkWrap: true,
itemBuilder:(_, index){
return Text('Index Number : '+index.toString());
}),
),
));

How do I add a splash effect on a card using GestureDetector

I wan't to add splash effect over the card when tapped on it.
I referred some of the answers on stackoverflow but, nothing caught up in my brai. HELP!!
My Code -
body: Container(
padding: EdgeInsets.all(10),
child: ListView(
children: <Widget>[
Container(
height: 100,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, '/page1');
},
child: GradientCard(
gradient: LinearGradient(
colors: [Colors.yellow, Colors.lightGreenAccent]),
elevation: 10,
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
child: Center(
child: Row(
children: <Widget>[
SizedBox(width: 25),
Icon(
Icons.favorite,
color: Colors.redAccent,
size: 50,
),
SizedBox(width: 40),
Text(
"MY CARD",
style: TextStyle(fontSize: 28),
),
],
),
),
),
),
),
),
],
),
),
I also tried to wrap onTap: function with InkWell with an ancestor as Material, But it won't let me to do so. Actually, I am confused now and stucked. Any help will be apperiated!!
Try this and let me know if that works!
Container(
padding: EdgeInsets.all(10),
child: ListView(
children: <Widget>[
Container(
height: 100,
child: GradientCard(
gradient: LinearGradient(
colors: [Colors.yellow, Colors.lightGreenAccent]
),
elevation: 10,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
Navigator.pushNamed(context, '/page1');
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
child: Center(
child: Row(
children: <Widget>[
SizedBox(width: 25),
Icon(
Icons.favorite,
color: Colors.redAccent,
size: 50,
),
SizedBox(width: 40),
Text(
"MY CARD",
style: TextStyle(fontSize: 28),
),
],
),
),
),
)
)
)
),
],
),
);
Try this:
Container(
height: 100,
child: Material(
elevation: 10,
color: Theme.of(context).cardColor,
child: InkWell(
onTap: () {
Navigator.pushNamed(context, '/page1');
},
child: Center(
child: Row(
children: <Widget>[
SizedBox(width: 25),
Icon(
Icons.favorite,
color: Colors.redAccent,
size: 50,
),
SizedBox(width: 40),
Text(
"MY CARD",
style: TextStyle(fontSize: 28),
),
],
),
),
),
),
)

flutter sliver list tabbar bottom overflowed error

I am a newbie of flutter.
I have just started to rebuild my android app built by Kotlin to flutter.
However, I am stuck in building the user page.
I intended to build the page like this screenshot
However, I continuously get bottom overflowed error.
How can I solve this problem?
I am looking forward to your help.
I will attach the whole code of the page.
import 'package:botanic_flutter/login_page.dart';
import 'package:botanic_flutter/main.dart';
import 'package:botanic_flutter/root_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:botanic_flutter/custom_color_scheme.dart';
import 'package:google_sign_in/google_sign_in.dart';
class AccountPage extends StatefulWidget {
final String userUid;
AccountPage(this.userUid);
#override
_AccountPageState createState() => _AccountPageState();
}
class _AccountPageState extends State<AccountPage> with SingleTickerProviderStateMixin {
final GoogleSignIn _googleSignIn = GoogleSignIn();
final FirebaseAuth _Auth = FirebaseAuth.instance;
FirebaseUser _currentUser;
TabController _controller;
#override
void initState() {
super.initState();
_controller = new TabController(length: 2, vsync: this);
}
#override
void dispose() {
_controller.dispose();
super.dispose();
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: DefaultTabController(
length: 2,
child: NestedScrollView(
headerSliverBuilder: (context, isScrolled) {
return <Widget> [
SliverList(
// itemExtent: 300,
delegate: SliverChildListDelegate([
Container(
child: Column(
children: <Widget>[
_detailedBody()
],
),
)
]),
),
];
},
body: Column(
children: <Widget>[
TabBar(
unselectedLabelColor: Theme.of(context).colorScheme.greyColor,
labelColor: Theme.of(context).colorScheme.mainColor,
controller: _controller,
indicatorColor: Theme.of(context).colorScheme.mainColor,
tabs: [
Container(
height: 90,
padding: EdgeInsets.only(top: 20),
child: Tab(
icon: const Icon(Icons.home,
),
text: 'PLANTS',
),
),
Container(
height: 90,
padding: EdgeInsets.only(top: 20),
child: Tab(
icon: const Icon(Icons.bookmark_border,
),
text: 'BOOKMARK',
),
)
],
),
Expanded(
flex: 1,
child: TabBarView(
controller: _controller,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
child: Column(
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Padding(
padding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
child: Icon(
Icons.clear_all,
color: Colors.grey,
),
),
Container(
width: MediaQuery.of(context).size.width/3*1.4,
child: DropdownButton<String>(
isExpanded: true,
items: <String>['Foo', 'Bar'].map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (_) {},
),
),
Padding(
padding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 5.0),
child: Icon(
Icons.mode_edit,
color: Colors.grey,
),
),
Padding(
padding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 1.0),
child: Icon(
Icons.delete,
color: Colors.grey,
),
),
Padding(
padding: EdgeInsets.all(4.0),
),
Container(
height: 30,
width: MediaQuery.of(context).size.width/4.5,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.mainColor,
borderRadius: BorderRadius.all(Radius.circular(20)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.shade200,
offset: Offset(2, 4),
blurRadius: 5,
spreadRadius: 2)
],
),
child: FlatButton(
child: Text(
"+식물등록",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13,
color: Colors.white,
),
),
onPressed: () => {
},
),
),
],
),
),
Expanded(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1.0,
mainAxisSpacing: 1.0,
crossAxisSpacing: 1.0),
itemCount: notes.length,
itemBuilder: (context, index) => Card(
child: Image.network(notes[index],
fit: BoxFit.cover,
),
),
),
),
],
),
),
Container(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 1.0,
mainAxisSpacing: 1.0,
crossAxisSpacing: 1.0),
itemCount: notes.length,
itemBuilder: (context, index) => Card(
child: Image.network(notes[index],
fit: BoxFit.cover,
),
),
),
)
],
),
),
],
),
),
),
);
}
Widget _detailedBody() {
return SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 3 / 4,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
'http://www.korea.kr/newsWeb/resources/attaches/2017.08/03/3737_cp.jpg'),
),
),
),
Container(
transform: Matrix4.translationValues(0.0, -41.0, 0.0),
child: Column(
children: <Widget>[
Stack(
alignment: Alignment.center,
children: <Widget>[
SizedBox(
width: 90.0,
height: 90.0,
child: CircleAvatar(
backgroundColor: Colors.white,
),
),
SizedBox(
width: 82.0,
height: 82.0,
child: CircleAvatar(
backgroundImage: NetworkImage('https://steemitimages.com/DQmS1gGYmG3vL6PKh46A2r6MHxieVETW7kQ9QLo7tdV5FV2/IMG_1426.JPG')
),
),
Container(
width: 90.0,
height: 90.0,
alignment: Alignment.bottomRight,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
SizedBox(
width: 28.0,
height: 28.0,
child: FloatingActionButton(
onPressed: null,
backgroundColor: Colors.white,
//child: Icon(Icons.add),
),
),
SizedBox(
width: 25.0,
height: 25.0,
child: FloatingActionButton(
onPressed: null,
backgroundColor: Theme.of(context).colorScheme.mainColor,
child: Icon(Icons.add),
),
),
],
)
)
],
),
Padding(padding: EdgeInsets.all(5.0)),
Text(
'nickname',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 24.0),
),
Padding(padding: EdgeInsets.all(5.0)),
Text(
'introduce',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 15.0),
),
Padding(padding: EdgeInsets.all(9.0)),
FlatButton(
onPressed: () {
signOutWithGoogle().then((_) {
Navigator.popUntil(context, ModalRoute.withName('/'));
});
},
color: Theme.of(context).colorScheme.mainColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
child: Text('로그아웃'),
),
Padding(padding: EdgeInsets.all(9.0)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Column(
children: <Widget>[
Text(
'0',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16.0),
),
Text(
'식물수',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
],
),
Column(
children: <Widget>[
Text(
'0',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16.0),
),
Text(
'팔로워',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
],
),
Column(
children: <Widget>[
Text(
'0',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16.0),
),
Text(
'팔로잉',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20.0),
),
],
)
],
)
],
),
),
],
),
);
}
List<String> notes = [
'https://steemitimages.com/DQmS1gGYmG3vL6PKh46A2r6MHxieVETW7kQ9QLo7tdV5FV2/IMG_1426.JPG',
'https://lh3.googleusercontent.com/proxy/BKvyuWq6b5apNOqvSw3VxB-QhezYHAoX1AptJdWPl-Ktq-Efm2gotbeXFtFlkr_ZPZmpEHc2BsKTC9oFQgzBimKsf5oRtTqOGdlO3MTfwiOT54E5m-lCtt6ANOMzmhNsYMGRp9Pg1NzjwMRUWNoWX0oJEFcnFvjOj2Rr4LtZpkXyiQFO',
'https://img1.daumcdn.net/thumb/R720x0.q80/?scode=mtistory2&fname=http%3A%2F%2Fcfile28.uf.tistory.com%2Fimage%2F2343174F58DBC14C2ECB8B',
];
Future<void> signOutWithGoogle() async {
// Sign out with firebase
await _Auth.signOut();
// Sign out with google
await _googleSignIn.signOut();
}
}

Flutter Dropdownbutton widget not opening

I've added a dropdownbutton widget to my view and when I top on the control, it doesn't open to display the available values.
I've even tried to use sample code and it's still not showing. This widget is within a SingleChildScrollView. I changed it to container to see if it was a scroll issue, but that didn't even work.
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: DropdownButton(
elevation: 2,
value: 'One',
onChanged: (val){
print(val);
},
hint: Text(
"Select the leach",
style: TextStyle(
color: Colors.black,
),
),
items: <String>['One', 'Two', 'Free', 'Four']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
})
.toList()
)
),
When clicking/tapping on the control, it should show up, but I'm not sure what I'm missing that would cause it to not show the values.
I'm not seeing any errors in the logs (at least the logs i'm familiar with)
UPDATED WITH MORE CODE:
SafeArea(
child: Scaffold(
appBar: AppBar(
title: Hero(
tag: widget.film.title + widget.film.number,
child: Material(
type: MaterialType.transparency,
child: Text(
widget.film.title,
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
fontFamily: Constant.fontRegular,
fontWeight: FontWeight.bold,
),
),
),
),
),
body:
Container(
//color: Colors.white,
height: MediaQuery.of(context).size.height,
child: SingleChildScrollView(
physics: new AlwaysScrollableScrollPhysics(),
controller: _controller,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Stack(
overflow: Overflow.visible,
children: <Widget>[
MeetNetworkImage(
fit: BoxFit.cover,
width: MediaQuery.of(context).size.width,
imageUrl: widget.film.backdrop != null ? "https://image.tmdb.org/t/p/w400/" + widget.film.backdrop : "",
loadingBuilder: (context) => Center(
child: CircularProgressIndicator(),
),
errorBuilder: (context, e) => Center(
child: FadeInImage(
fit: BoxFit.fitWidth,
width: MediaQuery.of(context).size.width,
image: AssetImage('assets/images/placeholder.png'),
placeholder:
AssetImage('assets/images/placeholder.png'),
),
),
),
Positioned(
left: MediaQuery.of(context).size.width-60,
top: 10,
child: Container(
height: 40.0,
width: 50.0,
color: Colors.transparent,
child: new Container(
decoration: new BoxDecoration(
color: widget.film.checkedoutby == null ? Colors.green : Colors.red,
borderRadius: new BorderRadius.all(Radius.circular(10))),
child: new Center(
child: new Text(widget.film.number, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0),),
)),
),
),
Positioned(
top: 180,
left: 15,
child: Container(
height: 200.0,
//color: Colors.grey[200],
child: MeetNetworkImage(
fit: BoxFit.contain,
imageUrl: widget.film.poster != null
? "https://image.tmdb.org/t/p/w200/" + widget.film.poster
: "",
loadingBuilder: (context) => Center(
child: CircularProgressIndicator(),
),
errorBuilder: (context, e) => Center(
child: FadeInImage(
fit: BoxFit.fill,
width: MediaQuery.of(context).size.width,
image:
AssetImage('assets/images/placeholder.png'),
placeholder:
AssetImage('assets/images/placeholder.png'),
),
),
),
),
),
Positioned(
left: 155,
top: 225,
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Text(
'Check Out',
style: TextStyle(
fontFamily: Constant.fontRegular,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: widget.users != null ?
DropdownButton(
elevation: 2,
value: widget.film.checkedoutby != null ? widget.film.checkedoutby : null,
onChanged: (val){
print(val);
},
hint: Text(
"Select the leach",
style: TextStyle(
color: Colors.black,
),
),
items: <String>['One', 'Two', 'Free', 'Four']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
})
.toList())
),
],
),
),
Container(
padding: EdgeInsets.all(8.0),
alignment: FractionalOffset.centerLeft,
child: Wrap(
children: <Widget>[
Text(
'Rating -',
style: TextStyle(
fontFamily: Constant.fontRegular,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Text(
widget.film.rating,
style: TextStyle(
fontFamily: Constant.fontRegular,
color: Colors.grey[500]),
),
),
],
),
),
Container(
padding: EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Text(
'Duration -',
style: TextStyle(
fontFamily: Constant.fontRegular,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Text(
widget.film.runtime == null ? "" : widget.film.runtime,
style: TextStyle(
fontFamily: Constant.fontRegular,
color: Colors.grey[500]),
),
),
],
),
),
Container(
padding: EdgeInsets.all(8.0),
alignment: FractionalOffset.centerLeft,
child: Wrap(
children: <Widget>[
Text(
'Released -',
style: TextStyle(
fontFamily: Constant.fontRegular,
fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Wrap(
alignment: WrapAlignment.start,
children: <Widget>[
Text(
widget.film.released ?? "",
style: TextStyle(
fontFamily: Constant.fontRegular,
color: Colors.grey[500]),
)
],
),
)
],
),
),
],
),
),
Positioned(
top: 395,
left: 10,
width: MediaQuery.of(context).size.width-10,
child: Column(
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(child: Text(widget.film.plot)),
],
),
Divider(),
Wrap(
children: widget.film.genre
.split(',')
.map<Widget>(
(f) => Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Chip(
labelPadding:
EdgeInsets.symmetric(horizontal: 8.0),
label: Text(f,
style: TextStyle(
color: Colors.white,
fontFamily: Constant.fontMedium,
)),
backgroundColor:
Theme.of(context).primaryColor,
),
),
).toList(),
),
],
),
),
],
),
],
),
),
),
),
);
Not exactly sure why there is a difference in what I posted above and what the solution ended up being, but here's what I've changed the view to in order to get the dropdown popover to display.
As I was debugging, I broke it down bit by bit and noticed that when I added a container with a height to take up half the view, the popover would show, but clear at the bottom of that container, essentially pushing the top location of the dropdown's list, to the bottom of the container it was in. So I'm assuming the the popover that displays the list is 'showing', but below the container so it appears to not be working. Not sure why it would attach to the 'outside' of the main parent container, but that looks like this is what it is doing.
So....I changed the setup of the scaffolds body: property to be this instead:
SingleChildScrollView(
physics: new AlwaysScrollableScrollPhysics(),
controller: _controller,
child: ConstrainedBox(
constraints: BoxConstraints.tightFor(
height: MediaQuery.of(context).size.height,
),
child: Stack(
.....