我是新手。我在同一脚手架上有一个登录(和bloc)和注册(和bloc)小部件:
const nonNegativeSubtraction = (arr, n) => {
const map = arr.map(x => x - (n / arr.length));
const not = map.filter(x => x < 0);
const matches = map.filter(x => x >= 0);
const subtotal = not.reduce((a, b) => a + b);
const N = Math.abs(subtotal) / (matches.length - not.length);
const result = map.map(x => x <= 0 ? 0 : +(x - N).toFixed(3));
return result;
}
const test = [0, 0, 1 - 0.333, 2 - 0.333, 3 - 0.333];
let input = [4,5,6,7,8]; // minuend
let n = 25; // subtrahend
let res = nonNegativeSubtraction(input, n); // result
console.log(res);
console.assert(JSON.stringify(test) !== JSON.stringify(res), [test, res]);
登录集团:
@override
Widget build(BuildContext context) {
_init(context);
return Scaffold(
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(
child: new Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: PageView(
controller: _controller,
physics: new AlwaysScrollableScrollPhysics(),
children: <Widget>[LoginPage(), HomePage(), SignupPage()],
scrollDirection: Axis.horizontal,
))));
}
}
Register Bloc与Login Bloc非常相似,不需要发布。
每当我滑动到“登录/注册”然后再回到“注册/登录”时,都会出现错误消息:“状态错误:流已经被监听。”
答案 0 :(得分:1)
解决了!我为登录和注册创建了两个单独的文件。它解决了问题。