I had a problem when I slide my slide_to_act widget it works correctly and it push me to another page. but when I use nav.pop ( when I turn back to old page ) my slide_to_act button looks done. I want to reset it.
SlideAction(
height: 70,
sliderRotate: false,
alignment: Alignment.centerRight,
onSubmit: () {
slideAnimated_push(
context,
ConfirmPage(
total: summedPrice.toInt(), slevee: slevee));
},
innerColor: Colors.white,
outerColor: StGreen,
elevation: 1,
text: 'Slide to Confirm',
textStyle: const TextStyle(
fontFamily: 'RaleWay',
fontSize: 20,
color: Colors.white,
),
),[enter image description here][1]
May be you can reset it after going to the other page.
Related
i use percent_indicator package. I wrapped CircularPercentIndicator with Gesturedetetor, i increase start parameter every touch onTap function.
Every time I tap to increase the numeric value by one, the CircularPercentIndicator color starts over. For example; My start parameter is 8 and once I touched it, my start parameter is 9, but the CircularPercentIndicator starts from 0 to 9.
int start = 0;
GestureDetector(
child: CircularPercentIndicator(
radius: 100.0,
lineWidth: 13.0,
animation: true,
percent: start.toDouble() / 100,
center: Text(
start.toString(),
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0),
),
footer: const Text(
"Sales this week",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17.0),
),
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.purple,
),
onTap: () {
start = start + 1;
setState(() {});
print(start.toString());
},
),
If you check the plugin source code, that is how the plugin is developed, it updates the progress, and runs the _animation.forward(), which will make the animation start from 0 - currentProgress.
I found the solution. There is a property like below.
animateFromLastPercent: true
I am making a flutter app and I have the next issue. The user needs to add the hour of the time they are open/closed . But when I want to scroll much more I am not able because of the scroll view don't stay intact much more .I will post o video to underwent better - https://imgur.com/a/KyQYRx0
Text(
'End Time: ',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 16.0),
),
DirectSelect(
itemExtent: 50.0,
selectedIndex: selectedIndex1,
backgroundColor: Colors.white30,
child: MySelectionItem(
isForList: false,
title: elements3[selectedIndex3],
),
onSelectedItemChanged: (index) {
setState(() {
selectedIndex3 = index;
});
},
items: _buildItems3()),
],
have you tried changing the background colour. Make it opaque and try it once
I am using SfCalender and want to pass one more parameter to a callBack of onTap
SfCalendar(
dataSource: _getDataSource(snapshot.data.data),
view: CalendarView.month,
showNavigationArrow: true,
monthViewSettings: MonthViewSettings(
showAgenda: true,
agendaStyle: AgendaStyle(
backgroundColor: Colors.transparent,
appointmentTextStyle: TextStyle(
color: Colors.white, fontSize: 13, fontStyle: FontStyle.italic),
dateTextStyle: TextStyle(
color: primaryColor, fontSize: 13, fontStyle: FontStyle.italic),
),
),
controller: _calendarController,
onTap: _openForm(array),
)
_openForm(CalendarTapDetails details) {
//code
}
Currently if I dont pass any argument to _openForm, CalenderDetails details have the values but I want to pass one array along with CalenderDetails details. How can I do that?
I don't know the SfCalendar library (and it is closed source), but I think you are trying to do that:
onTap: (details) => _openForm(details, array);
// ...
_openForm(CalendarTapDetails details, List myArray) {
// code
}
so i've been struggling to change the color of my button from green to red for my flutter app. Most of the online resources are confusing me. This is my following code.
new RaisedButton(key:null, onPressed:buttonPressed,
color: Colors.green,
child:
new Text(
"10:00 A.M. - 11:00 A.M.",
style: new TextStyle(fontSize:15.0,
color: const Color(0xFF000000),
fontWeight: FontWeight.w200,
fontFamily: "Roboto"),
)
),void buttonPressed(){
}
I want to click it and it turn green, or even better. Click it, so it turns gray. Then click another button that states "confirm", and it would make all the grey buttons that have been clicked red. Regardless, I'm just trying to understand how to make the button change color after being clicked.
Basically, what you need to do is,
Make RaisedButton color a class-level variable instead of constant as you have now.
Initialize that variable to some color value in initState method.
In the onPressed handler of RaisedButton, do the following:
Change that variable to some color value of your liking.
Trigger Repaint (so that the new color gets painted) i.e. call setState method.
Last but not least, you'll need to have all the code above part of a stateful widget.
Hopefully, it's clear enough, let us know if you'd need some code sample as well.
bool turnToRed = false;
bool colorIsGreen = true;
RaisedButton(key:null, onPressed: (){
setState((){
colorIsGreen = !colorIsGreen;
});
},
color: colorIsGreen ? Colors.green :turnToRed ? Colors.red : Colors.grey,
child:
new Text(
"10:00 A.M. - 11:00 A.M.",
style: new TextStyle(fontSize:15.0,
color: const Color(0xFF000000),
fontWeight: FontWeight.w200,
fontFamily: "Roboto"),
)
),
RaisedButton(key:null, onPressed: (){
setState((){
turnToRed = !turnToRed;
});
},
color: Colors.red
child:
new Text(
"Confirm",
style: new TextStyle(fontSize:15.0,
color: const Color(0xFF000000),
fontWeight: FontWeight.w200,
fontFamily: "Roboto"),
)
),
I have 10 field on a form and I want have a status tracker similar to the image below..
Basically , I will pass the percent and the widget should be updated
So if 4 items are completed then it will be 40% complete,,
Can you give me some hints on how to create this widget
I think this is somehow weird but may help!
you need a validator
You could make a function called checkProgress() and assign it to the onChanged of the textformfield:
void checkProgress() {
if(textformfieldcontroller.isValid) {
setstate(() {
progressbar = progressbar + 10;
});
} else if (textformfieldcontroller.isNotValid) {
setstate(() {});
}
}
It may work, but if not the concept is using if statements with setstate.
You can use the library percent_indicator
LinearPercentIndicator(animation: true,
lineHeight: 15,
animationDuration: 5000,
percent: 0.4,
backgroundColor: Colors.blue,
progressColor: Colors.orange,
center: Text(
'Text',
style: TextStyle(
color: Theme.of(context).primaryColorDark,
fontSize: 15,
fontWeight: FontWeight.w500),
),
linearStrokeCap: LinearStrokeCap.roundAll,
),
the parameter "percent" shows the progress in the indicator