我需要在类之间传递变量。 例如:
存档ClassN1.dart N1类内容变量1 = 0
存档ClassN2.dart N2类计算sumVariables = Variable1 * 2;
几天来,我一直在寻找有关它的信息。 从已经非常感谢您!
FirebaseApp.configure()
// View Controller Setup
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let mainViewController = ViewController()
mainViewController.view.backgroundColor = .black
window?.rootViewController = UINavigationController(rootViewController: mainViewController)
档案编号2.dart -状态= adecuado * 2
import 'package:flutter/material.dart';
import 'Funtion_Calculate.dart';
class DatesPrincipal extends StatelessWidget {
get left => null;
@override
Widget build(BuildContext context) {
return new Container(
child: Row(
children: <Widget>[
new Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ //First linea of dates
NumberDates(),
StatusNPS(),
PutDatesNPS()
],
),
)
],
),
);
}
}
class NumberDates extends StatefulWidget {
@override
_NumberDatesState createState() => _NumberDatesState();
}
class _NumberDatesState extends State<NumberDates> {
var adecuado = '0';
Widget build(BuildContext context) {
Widget iconList;
return iconList = DefaultTextStyle.merge(
style: descTextStyle,
child: Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Text(adecuado,
style: TextStyle(
fontSize: 18
),
),
Padding(
padding: EdgeInsets.all(4),
),
Text('Adecuado')
],
),
width: 100.0,
),
],
),
)
);
}
}