LCOV - code coverage report
Current view: top level - lib/views - globalsettingsview.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 27 0.0 %
Date: 2024-04-16 06:18:13 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:convert';
       2             : import 'package:cwtch/cwtch_icons_icons.dart';
       3             : import 'package:cwtch/views/globalsettingsaboutview.dart';
       4             : import 'package:cwtch/views/globalsettingsappearanceview.dart';
       5             : import 'package:cwtch/views/globalsettingsbehaviourview.dart';
       6             : import 'package:cwtch/views/globalsettingsexperimentsview.dart';
       7             : import 'package:flutter/material.dart';
       8             : import 'package:cwtch/settings.dart';
       9             : import 'package:provider/provider.dart';
      10             : import 'package:flutter_gen/gen_l10n/app_localizations.dart';
      11             : 
      12             : import '../main.dart';
      13             : 
      14             : /// Global Settings View provides access to modify all the Globally Relevant Settings including Locale, Theme and Experiments.
      15             : class GlobalSettingsView extends StatefulWidget {
      16           0 :   @override
      17           0 :   _GlobalSettingsViewState createState() => _GlobalSettingsViewState();
      18             : }
      19             : 
      20             : class _GlobalSettingsViewState extends State<GlobalSettingsView> {
      21             :   ScrollController settingsListScrollController = ScrollController();
      22             : 
      23           0 :   @override
      24             :   void dispose() {
      25           0 :     super.dispose();
      26             :   }
      27             : 
      28           0 :   @override
      29             :   Widget build(BuildContext context) {
      30           0 :     return DefaultTabController(
      31             :         length: 4,
      32           0 :         child: Scaffold(
      33           0 :           appBar: AppBar(
      34           0 :               title: Text(AppLocalizations.of(context)!.cwtchSettingsTitle),
      35           0 :               bottom: TabBar(
      36             :                 isScrollable: true,
      37           0 :                 tabs: [
      38           0 :                   Tab(key: Key("OpenSettingsAppearance"), icon: Icon(Icons.palette), text: AppLocalizations.of(context)!.settingsGroupAppearance),
      39           0 :                   Tab(key: Key("OpenSettingsBehaviour"), icon: Icon(Icons.settings), text: AppLocalizations.of(context)!.settingGroupBehaviour),
      40           0 :                   Tab(key: Key("OpenSettingsExperiments"), icon: Icon(CwtchIcons.enable_experiments), text: AppLocalizations.of(context)!.settingsGroupExperiments),
      41           0 :                   Tab(icon: Icon(Icons.info), text: AppLocalizations.of(context)!.settingsGroupAbout),
      42             :                 ],
      43             :               )),
      44           0 :           body: _buildSettingsList(),
      45             :         ));
      46             :   }
      47             : 
      48           0 :   Widget _buildSettingsList() {
      49           0 :     return Consumer<Settings>(builder: (ccontext, settings, child) {
      50           0 :       return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
      51           0 :         return TabBarView(children: [
      52           0 :           GlobalSettingsAppearanceView(),
      53           0 :           GlobalSettingsBehaviourView(),
      54           0 :           GlobalSettingsExperimentsView(),
      55           0 :           GlobalSettingsAboutView(),
      56             :         ]);
      57             :       });
      58             :     });
      59             :   }
      60             : }
      61             : 
      62             : /// Send an UpdateGlobalSettings to the Event Bus
      63           0 : saveSettings(context) {
      64           0 :   var settings = Provider.of<Settings>(context, listen: false);
      65           0 :   Provider.of<FlwtchState>(context, listen: false).cwtch.UpdateSettings(jsonEncode(settings.asJson()));
      66             : }

Generated by: LCOV version 1.14