работа с цветом
This commit is contained in:
parent
5fc5f8b3d8
commit
2422274ea3
|
@ -11,7 +11,7 @@ Graphs getGraph() {
|
||||||
d.add(Dot.fromTwoLists("3", [1, 2], [1, 2]));
|
d.add(Dot.fromTwoLists("3", [1, 2], [1, 2]));
|
||||||
//d.add(Dot.fromTwoLists("Name1", [], []));
|
//d.add(Dot.fromTwoLists("Name1", [], []));
|
||||||
//d.add(Dot.fromTwoLists("Name2", [], []));
|
//d.add(Dot.fromTwoLists("Name2", [], []));
|
||||||
return Graphs.fromList("UMYA", d, true, true);
|
return Graphs.fromList("Имя", d, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
class DrawingPage extends StatefulWidget {
|
class DrawingPage extends StatefulWidget {
|
||||||
|
@ -57,7 +57,7 @@ class _DrawingPageState extends State<DrawingPage> {
|
||||||
))),
|
))),
|
||||||
toolbarHeight: 110,
|
toolbarHeight: 110,
|
||||||
flexibleSpace: Container(
|
flexibleSpace: Container(
|
||||||
color: Colors.blue,
|
color: Colors.green.shade900,
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
|
@ -148,10 +148,13 @@ class _DrawingPageState extends State<DrawingPage> {
|
||||||
ElevatedButton createButton(String txt, void onPressing()) {
|
ElevatedButton createButton(String txt, void onPressing()) {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
onPressed: onPressing,
|
onPressed: onPressing,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.resolveWith<Color>(
|
||||||
|
(states) => Colors.green.shade700)),
|
||||||
child: Text(txt,
|
child: Text(txt,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
color: Colors.white,
|
color: Colors.white70,
|
||||||
height: 1,
|
height: 1,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
@ -244,7 +247,7 @@ class _DrawingPageState extends State<DrawingPage> {
|
||||||
if (_textNumbController.text == "") {
|
if (_textNumbController.text == "") {
|
||||||
showPopUp("Error", "No number in \"Dot number\" box");
|
showPopUp("Error", "No number in \"Dot number\" box");
|
||||||
} else if (_textDestController.text == "") {
|
} else if (_textDestController.text == "") {
|
||||||
showPopUp("Error", "No name in \"Destination number\" box");
|
showPopUp("Error", "No number in \"Destination number\" box");
|
||||||
} else if (_textLnthController.text == "" &&
|
} else if (_textLnthController.text == "" &&
|
||||||
graphData.getUseLengthBool()) {
|
graphData.getUseLengthBool()) {
|
||||||
showPopUp("Error", "No length in \"Input length\" box");
|
showPopUp("Error", "No length in \"Input length\" box");
|
||||||
|
@ -368,7 +371,7 @@ class _DrawingPageState extends State<DrawingPage> {
|
||||||
if (_textNumbController.text == "") {
|
if (_textNumbController.text == "") {
|
||||||
showPopUp("Error", "No number in \"Dot number\" box");
|
showPopUp("Error", "No number in \"Dot number\" box");
|
||||||
} else if (_textDestController.text == "") {
|
} else if (_textDestController.text == "") {
|
||||||
showPopUp("Error", "No name in \"Destination number\" box");
|
showPopUp("Error", "No number in \"Destination number\" box");
|
||||||
} else {
|
} else {
|
||||||
int? from = int.tryParse(_textNumbController.text);
|
int? from = int.tryParse(_textNumbController.text);
|
||||||
int? to = int.tryParse(_textDestController.text);
|
int? to = int.tryParse(_textDestController.text);
|
||||||
|
|
|
@ -537,7 +537,7 @@ class Graphs {
|
||||||
}
|
}
|
||||||
|
|
||||||
//************Алгоритмы************
|
//************Алгоритмы************
|
||||||
/* bool bfsHasPath(int startDot, int goalDot) {
|
/* bool bfsHasPath(int startDot, int goalDot) {
|
||||||
// обход в ширину
|
// обход в ширину
|
||||||
startDot--;
|
startDot--;
|
||||||
goalDot--;
|
goalDot--;
|
||||||
|
@ -629,21 +629,25 @@ class Graphs {
|
||||||
|
|
||||||
List<bool>? dfsIterative(int v) {
|
List<bool>? dfsIterative(int v) {
|
||||||
v--;
|
v--;
|
||||||
|
//List<int>? pos = <int>[];
|
||||||
List<bool> label = <bool>[];
|
List<bool> label = <bool>[];
|
||||||
for (int i = 0; i < _amount; i++) {
|
for (int i = 0; i < _amount; i++) {
|
||||||
label.add(false);
|
label.add(false);
|
||||||
}
|
}
|
||||||
List<int> stack = <int>[];
|
List<int> stack = <int>[];
|
||||||
stack.add(v);
|
stack.add(v);
|
||||||
|
//pos.add(v);
|
||||||
while (stack.isNotEmpty) {
|
while (stack.isNotEmpty) {
|
||||||
v = stack.removeLast();
|
v = stack.removeLast();
|
||||||
if (!label[v]) {
|
if (!label[v]) {
|
||||||
label[v] = true;
|
label[v] = true;
|
||||||
for (int i in _dots[v].getL().keys) {
|
for (int i in _dots[v].getL().keys) {
|
||||||
stack.add(i - 1);
|
stack.add(i - 1);
|
||||||
|
//pos.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//print(pos);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue