如果更改通知者的类型为bool,我可以这样更改文本:
import pandas as pd
from bokeh.plotting import figure
from bokeh.io import output_file, show, curdoc
from bokeh.layouts import gridplot, widgetbox, row, column
from bokeh.models import HoverTool, ColumnDataSource,CategoricalColorMapper, Slider, CustomJS, CheckboxButtonGroup, Select, CheckboxGroup, RadioGroup, Toggle, Button, Dropdown
df1 = pd.read_csv('C:/PStuff/dataA.txt')
p1 = figure(plot_width=600, plot_height=300)
source1 = ColumnDataSource(data={'x':df1['num'],'y1':df1['col1'], 'y2':df1[new]})
p1.multi_line(x = 'x', ys = ['y1', 'y2'], source=source1)
menu1 = Select(options=['col1', 'col2', 'col3', 'col4'], value='col1', title='Welds')
def callback1(attr, old, new):
source1.data.update({'y':df1[new]})
menu1.on_change('value', callback1)
# show(row(p1, menu1))
layout = column(menu1, p1)
curdoc().add_root(layout)
LoginorSignup.dart:
...
Consumer<LoginOrSignup>(
builder: (context, value, child) =>
Text(value.isSignup? "Sign up" : "Login")
)
...
如果 _isSignup 类型为int,如何更改文本?
答案 0 :(得分:0)
是的,应该将方法添加到 LoginOrSignup 类中,然后在需要时调用此方法,如下所示:
import 'package:flutter/foundation.dart';
class LoginOrSignup extends ChangeNotifier{
bool _isSignup = false;
bool get isSignup => _isSignup;
void changeStatus(bool status){
_isSignup = status;
notifyListeners();
}
}
在您的视像通话中
value.changeStatus(false); //or true