File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,6 +251,16 @@ class _FarmDetailsState extends State<FarmDetails> {
251251
252252 @override
253253 Widget build (BuildContext context) {
254+ final sortedNodes = List .from (widget.farm.nodes)
255+ ..sort ((a, b) {
256+ if (a.status == NodeStatus .Up && b.status != NodeStatus .Up ) {
257+ return - 1 ;
258+ } else if (a.status != NodeStatus .Up && b.status == NodeStatus .Up ) {
259+ return 1 ;
260+ } else {
261+ return 0 ;
262+ }
263+ });
254264 return Scaffold (
255265 appBar: AppBar (
256266 title: Text (widget.farm.name),
@@ -526,9 +536,9 @@ class _FarmDetailsState extends State<FarmDetails> {
526536 ListView .builder (
527537 shrinkWrap: true ,
528538 physics: const NeverScrollableScrollPhysics (),
529- itemCount: widget.farm.nodes .length,
539+ itemCount: sortedNodes .length,
530540 itemBuilder: (context, index) {
531- final node = widget.farm.nodes [index];
541+ final node = sortedNodes [index];
532542 return Card (
533543 margin: const EdgeInsets .symmetric (
534544 vertical: 4.0 , horizontal: 0.0 ),
You can’t perform that action at this time.
0 commit comments