работа с цветом

This commit is contained in:
Морозов Андрей 2021-11-09 04:15:36 +04:00
parent 5fc5f8b3d8
commit 2422274ea3
2 changed files with 13 additions and 6 deletions

View File

@ -11,7 +11,7 @@ Graphs getGraph() {
d.add(Dot.fromTwoLists("3", [1, 2], [1, 2]));
//d.add(Dot.fromTwoLists("Name1", [], []));
//d.add(Dot.fromTwoLists("Name2", [], []));
return Graphs.fromList("UMYA", d, true, true);
return Graphs.fromList("Имя", d, true, true);
}
class DrawingPage extends StatefulWidget {
@ -57,7 +57,7 @@ class _DrawingPageState extends State<DrawingPage> {
))),
toolbarHeight: 110,
flexibleSpace: Container(
color: Colors.blue,
color: Colors.green.shade900,
child: Column(children: <Widget>[
const SizedBox(height: 5),
Row(children: [
@ -148,10 +148,13 @@ class _DrawingPageState extends State<DrawingPage> {
ElevatedButton createButton(String txt, void onPressing()) {
return ElevatedButton(
onPressed: onPressing,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(states) => Colors.green.shade700)),
child: Text(txt,
style: const TextStyle(
fontSize: 15,
color: Colors.white,
color: Colors.white70,
height: 1,
)),
);
@ -244,7 +247,7 @@ class _DrawingPageState extends State<DrawingPage> {
if (_textNumbController.text == "") {
showPopUp("Error", "No number in \"Dot number\" box");
} else if (_textDestController.text == "") {
showPopUp("Error", "No name in \"Destination number\" box");
showPopUp("Error", "No number in \"Destination number\" box");
} else if (_textLnthController.text == "" &&
graphData.getUseLengthBool()) {
showPopUp("Error", "No length in \"Input length\" box");
@ -368,7 +371,7 @@ class _DrawingPageState extends State<DrawingPage> {
if (_textNumbController.text == "") {
showPopUp("Error", "No number in \"Dot number\" box");
} else if (_textDestController.text == "") {
showPopUp("Error", "No name in \"Destination number\" box");
showPopUp("Error", "No number in \"Destination number\" box");
} else {
int? from = int.tryParse(_textNumbController.text);
int? to = int.tryParse(_textDestController.text);

View File

@ -629,21 +629,25 @@ class Graphs {
List<bool>? dfsIterative(int v) {
v--;
//List<int>? pos = <int>[];
List<bool> label = <bool>[];
for (int i = 0; i < _amount; i++) {
label.add(false);
}
List<int> stack = <int>[];
stack.add(v);
//pos.add(v);
while (stack.isNotEmpty) {
v = stack.removeLast();
if (!label[v]) {
label[v] = true;
for (int i in _dots[v].getL().keys) {
stack.add(i - 1);
//pos.add(i);
}
}
}
//print(pos);
return label;
}