LCOV - code coverage report
Current view: top level - lib/widgets - remoteserverrow.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 48 0.0 %
Date: 2024-09-24 21:50:54 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:cwtch/main.dart';
       2             : import 'package:cwtch/models/profile.dart';
       3             : import 'package:cwtch/models/remoteserver.dart';
       4             : import 'package:cwtch/themes/opaque.dart';
       5             : import 'package:cwtch/views/remoteserverview.dart';
       6             : import 'package:flutter/material.dart';
       7             : import 'package:provider/provider.dart';
       8             : 
       9             : import '../cwtch_icons_icons.dart';
      10             : import '../settings.dart';
      11             : 
      12             : class RemoteServerRow extends StatefulWidget {
      13           0 :   @override
      14           0 :   _RemoteServerRowState createState() => _RemoteServerRowState();
      15             : }
      16             : 
      17             : class _RemoteServerRowState extends State<RemoteServerRow> {
      18           0 :   @override
      19             :   Widget build(BuildContext context) {
      20           0 :     var server = Provider.of<RemoteServerInfoState>(context);
      21           0 :     var description = server.description.isNotEmpty ? server.description : server.onion;
      22           0 :     var running = server.status == "Synced";
      23           0 :     return Consumer<ProfileInfoState>(builder: (context, profile, child) {
      24           0 :       return InkWell(
      25             :           enableFeedback: true,
      26             :           splashFactory: InkSplash.splashFactory,
      27           0 :           child: Ink(
      28             :               color: Colors.transparent,
      29           0 :               child: Container(
      30           0 :                   child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
      31           0 :                 Padding(
      32             :                     padding: const EdgeInsets.all(6.0), //border size
      33           0 :                     child: Row(children: [
      34           0 :                       Icon(CwtchIcons.dns_24px,
      35           0 :                           color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor, size: 64),
      36           0 :                       Visibility(
      37             :                           visible: !running,
      38           0 :                           child: Icon(
      39             :                             CwtchIcons.negative_heart_24px,
      40           0 :                             color: Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
      41             :                           )),
      42             :                     ])),
      43           0 :                 Expanded(
      44           0 :                     child: Column(
      45           0 :                   children: [
      46           0 :                     Text(
      47             :                       description,
      48             :                       semanticsLabel: description,
      49           0 :                       style: Provider.of<Settings>(context)
      50           0 :                           .scaleFonts(defaultFormLabelTextStyle)
      51           0 :                           .copyWith(fontWeight: FontWeight.bold)
      52           0 :                           .apply(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
      53             :                       softWrap: true,
      54             :                       overflow: TextOverflow.ellipsis,
      55             :                     ),
      56           0 :                     Visibility(
      57           0 :                         visible: !Provider.of<Settings>(context).streamerMode,
      58           0 :                         child: ExcludeSemantics(
      59           0 :                             child: Text(
      60           0 :                           server.onion,
      61             :                           softWrap: true,
      62             :                           overflow: TextOverflow.ellipsis,
      63           0 :                           style: TextStyle(color: running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor),
      64             :                         ))),
      65           0 :                     Visibility(
      66           0 :                         visible: server.status == "Authenticated",
      67           0 :                         child: LinearProgressIndicator(
      68           0 :                           color: Provider.of<Settings>(context).theme.defaultButtonActiveColor,
      69           0 :                           backgroundColor: Provider.of<Settings>(context).theme.defaultButtonDisabledColor,
      70           0 :                           value: server.syncProgress,
      71             :                         )),
      72             :                   ],
      73             :                 )),
      74             :               ]))),
      75           0 :           onTap: () {
      76           0 :             Navigator.of(context).push(
      77           0 :               PageRouteBuilder(
      78           0 :                 settings: RouteSettings(name: "remoteserverview"),
      79           0 :                 pageBuilder: (bcontext, a1, a2) {
      80           0 :                   return MultiProvider(
      81           0 :                     providers: [ChangeNotifierProvider.value(value: profile), ChangeNotifierProvider.value(value: server), Provider.value(value: Provider.of<FlwtchState>(context))],
      82           0 :                     child: RemoteServerView(),
      83             :                   );
      84             :                 },
      85           0 :                 transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
      86           0 :                 transitionDuration: Duration(milliseconds: 200),
      87             :               ),
      88             :             );
      89             :           });
      90             :     });
      91             :   }
      92             : }

Generated by: LCOV version 1.14