Comments (7)
Okay, sir. I will adjust it to the default, if it doesn't work, I will get back to you.
from dropdown_button2.
Thanks worked, yeah, just thought about that
You don't have to set it to default, just try to increase the value. You're trying to put a text with
fontSize: 14
into an item withitemHeight: 5
and it doesn't fit. I think that was cause your issue.
Yeah, true, thanks a lot for your support
from dropdown_button2.
Can you provide a sample code of your issue? I think this is related to itemHeight
you're using
from dropdown_button2.
Here is my code sir
`import 'package:fidacom_app/screens/affiliate_application/application_coperate_screen.dart';
import 'package:fidacom_app/screens/affiliate_application/application_individual_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import '../../theme.dart';
class ApplicationTypeSelectionScreen extends StatefulWidget {
const ApplicationTypeSelectionScreen({Key? key}) : super(key: key);
@OverRide
State createState() =>
_ApplicationTypeSelectionScreenState();
}
class _ApplicationTypeSelectionScreenState
extends State {
final List applicationTypes = [
"Cooperate Application",
"Individual Application"
];
String? selectedValue;
@OverRide
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
kLightPrimary,
Colors.white,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
)),
child: Scaffold(
backgroundColor: Colors.transparent,
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: Padding(
padding: const EdgeInsets.all(12),
child: SvgPicture.asset("assets/svgs/arraow-back.svg"),
),
centerTitle: true,
title: const Text("Application"),
),
body: SafeArea(
child: SizedBox(
height: double.infinity,
width: double.infinity,
child: Stack(
children: [
const Positioned(
top: 20,
child: Divider(
color: Colors.grey,
),
),
Positioned(
bottom: 0,
child: Center(
child: Container(
height: MediaQuery
.of(context)
.size
.height * 0.5,
width: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration(
color: Colors.white,
),
child: Column(
children: [
const SizedBox(
width: 120,
child: Divider(
thickness: 2,
color: kPrimaryMain,
height: 0)),
SizedBox(
height: 32
),
Text("Select your application type to proceed"),
SizedBox(
height: 16,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: DropdownButtonHideUnderline(
child: DropdownButton2(
isExpanded: true,
hint: Row(
children: const [
SizedBox(
width: 4,
),
Expanded(
child: Text(
'Application type',
style: TextStyle(
fontSize: 14,
color: kPrimary75,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
items: applicationTypes
.map((item) =>
DropdownMenuItem(
value: item,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
color: kPrimary75,
),
overflow: TextOverflow.ellipsis,
),
))
.toList(),
value: selectedValue,
onChanged: (value) {
setState(() {
selectedValue = value as String;
});
if (selectedValue ==
'Cooperate Application') {
Navigator.push(
context,
MaterialPageRoute(
builder: () =>
const ApplicationCoperateScreen(),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: () =>
const ApplicationIndividualScreen(),
),
);
}
},
icon: const Icon(
Icons.keyboard_arrow_down_outlined,
),
iconSize: 22,
iconEnabledColor: kPrimary75,
iconDisabledColor: Colors.grey,
buttonHeight: 50,
buttonWidth: double.infinity,
buttonPadding:
const EdgeInsets.only(left: 14, right: 14),
buttonDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: Colors.transparent,
),
color: Colors.white,
),
buttonElevation: 1,
itemHeight: 5,
itemPadding:
const EdgeInsets.only(left: 14, right: 14),
dropdownMaxHeight: 200,
dropdownWidth:
MediaQuery
.of(context)
.size
.width * 0.9,
dropdownPadding:
const EdgeInsets.symmetric(horizontal: 20),
dropdownDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.white,
),
dropdownElevation: 3,
scrollbarRadius: const Radius.circular(40),
scrollbarThickness: 6,
scrollbarAlwaysShow: true,
offset: const Offset(0, -20),
),
),
),
],
),
),
),
),
],
),
),
),
),
);
}
}
`
from dropdown_button2.
Here is my code sir
`import 'package:fidacom_app/screens/affiliate_application/application_coperate_screen.dart'; import 'package:fidacom_app/screens/affiliate_application/application_individual_screen.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
import '../../theme.dart';
class ApplicationTypeSelectionScreen extends StatefulWidget { const ApplicationTypeSelectionScreen({Key? key}) : super(key: key);
@OverRide State createState() => _ApplicationTypeSelectionScreenState(); }
class _ApplicationTypeSelectionScreenState extends State { final List applicationTypes = [ "Cooperate Application", "Individual Application" ];
String? selectedValue;
@OverRide Widget build(BuildContext context) { return Container( decoration: const BoxDecoration( gradient: LinearGradient( colors: [ kLightPrimary, Colors.white, ], begin: Alignment.topLeft, end: Alignment.bottomRight, )), child: Scaffold( backgroundColor: Colors.transparent, extendBodyBehindAppBar: true, appBar: AppBar( backgroundColor: Colors.transparent, elevation: 0, leading: Padding( padding: const EdgeInsets.all(12), child: SvgPicture.asset("assets/svgs/arraow-back.svg"), ), centerTitle: true, title: const Text("Application"), ), body: SafeArea( child: SizedBox( height: double.infinity, width: double.infinity, child: Stack( children: [ const Positioned( top: 20, child: Divider( color: Colors.grey, ), ), Positioned( bottom: 0, child: Center( child: Container( height: MediaQuery .of(context) .size .height * 0.5, width: MediaQuery .of(context) .size .width, decoration: BoxDecoration( color: Colors.white, ), child: Column( children: [ const SizedBox( width: 120, child: Divider( thickness: 2, color: kPrimaryMain, height: 0)), SizedBox( height: 32 ), Text("Select your application type to proceed"), SizedBox( height: 16, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: DropdownButtonHideUnderline( child: DropdownButton2( isExpanded: true, hint: Row( children: const [ SizedBox( width: 4, ), Expanded( child: Text( 'Application type', style: TextStyle( fontSize: 14, color: kPrimary75, ), overflow: TextOverflow.ellipsis, ), ), ], ), items: applicationTypes .map((item) => DropdownMenuItem( value: item, child: Text( item, style: const TextStyle( fontSize: 14, color: kPrimary75, ), overflow: TextOverflow.ellipsis, ), )) .toList(), value: selectedValue, onChanged: (value) { setState(() { selectedValue = value as String; }); if (selectedValue == 'Cooperate Application') { Navigator.push( context, MaterialPageRoute( builder: () => const ApplicationCoperateScreen(), ), ); } else { Navigator.push( context, MaterialPageRoute( builder: () => const ApplicationIndividualScreen(), ), ); } }, icon: const Icon( Icons.keyboard_arrow_down_outlined, ), iconSize: 22, iconEnabledColor: kPrimary75, iconDisabledColor: Colors.grey, buttonHeight: 50, buttonWidth: double.infinity, buttonPadding: const EdgeInsets.only(left: 14, right: 14), buttonDecoration: BoxDecoration( borderRadius: BorderRadius.circular(5), border: Border.all( color: Colors.transparent, ), color: Colors.white, ), buttonElevation: 1, itemHeight: 5, itemPadding: const EdgeInsets.only(left: 14, right: 14), dropdownMaxHeight: 200, dropdownWidth: MediaQuery .of(context) .size .width * 0.9, dropdownPadding: const EdgeInsets.symmetric(horizontal: 20), dropdownDecoration: BoxDecoration( borderRadius: BorderRadius.circular(5), color: Colors.white, ), dropdownElevation: 3, scrollbarRadius: const Radius.circular(40), scrollbarThickness: 6, scrollbarAlwaysShow: true, offset: const Offset(0, -20), ), ), ), ], ), ), ), ), ], ), ), ), ), ); } } `
Please note that I didn't change any code since yesterday
from dropdown_button2.
You're setting itemHeight: 5
. I think this what cause your issue
from dropdown_button2.
You don't have to set it to default, just try to increase the value. You're trying to put a text with fontSize: 14
into an item with itemHeight: 5
and it doesn't fit. I think that was cause your issue.
from dropdown_button2.
Related Issues (20)
- Example 4 | Multi Select Dropdown HOT 1
- searchData not working in release app (show grey blank dropdown container) this code HOT 1
- Failed assertion: line 991 pos 11 ... There shoiuld be exactly one item with DropdownButtons ...
- somehow i delet class of DropdownButton2 class ,i dont know how to ReCreate or ReAdd it please Share me Solution @AhmedLSayed HOT 1
- Disable dropdown button HOT 1
- button have a shadow
- Using DropdownButton2 above the Navigator
- update selected value when menu is closed.
- Why can't find dropdownSeparator
- Can't change thumb color
- Conflicting paddings in MenuItemStyleData, DropDownStyleData, and ButtonStyleData HOT 11
- Can't open dialog on menu item tap HOT 1
- overlayColor has no effect HOT 6
- Searching item.child not working on release mode but in debug mode run successfully. HOT 1
- `DropdownButtonFormField2` doesn't hide its underline. HOT 1
- How to set MouseCursor
- When the window size changes, the pop-up layer position is incorrect HOT 5
- DropDown button 2 latest beta fails with empty dropdown HOT 3
- List displayed under helpertext
- Can we keep value as well for beta version? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropdown_button2.