Skip to content

Commit

Permalink
feat: use native TextField
Browse files Browse the repository at this point in the history
Signed-off-by: validcube <pun.butrach@gmail.com>
  • Loading branch information
validcube committed Dec 30, 2023
1 parent 975180b commit 9ed43ef
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 230 deletions.
10 changes: 5 additions & 5 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ManagerAPI {
String defaultKeystorePassword = 's3cur3p@ssw0rd';
String defaultApiUrl = 'https://api.revanced.app/';
String defaultRepoUrl = 'https://api.github.com';
String defaultPatcherRepo = 'revanced/revanced-patcher';
String defaultPatchesRepo = 'revanced/revanced-patches';
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
String defaultCliRepo = 'revanced/revanced-cli';
String defaultManagerRepo = 'revanced/revanced-manager';
String defaultPatcherRepo = 'ReVanced/revanced-patcher';
String defaultPatchesRepo = 'ReVanced/revanced-patches';
String defaultIntegrationsRepo = 'ReVanced/revanced-integrations';
String defaultCliRepo = 'ReVanced/revanced-cli';
String defaultManagerRepo = 'ReVanced/revanced-manager';
String? patchesVersion = '';
String? integrationsVersion = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:stacked/stacked.dart';

Expand Down Expand Up @@ -35,15 +34,19 @@ class SManageApiUrl extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: Icon(
Icons.api_outlined,
color: Theme.of(context).colorScheme.secondary,
),
inputController: _apiUrlController,
label: I18nText('settingsView.selectApiURL'),
hint: apiUrl,
TextField(
controller: _apiUrlController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: Icon(
Icons.api_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText('settingsView.selectApiURL').toString(),
hintText: apiUrl,
),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:stacked/stacked.dart';

Expand Down Expand Up @@ -35,11 +34,17 @@ class SManageKeystorePassword extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
inputController: _keystorePasswordController,
label: I18nText('settingsView.selectKeystorePassword'),
hint: '',
TextField(
controller: _keystorePasswordController,
autocorrect: false,
obscureText: true,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.selectKeystorePassword',
).toString(),
),
),
],
),
Expand Down
123 changes: 80 additions & 43 deletions lib/ui/views/settings/settingsFragment/settings_manage_sources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:stacked/stacked.dart';

Expand Down Expand Up @@ -45,59 +44,97 @@ class SManageSources extends BaseViewModel {
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
inputController: _hostSourceController,
label: I18nText('settingsView.hostRepositoryLabel'),
hint: hostRepository,
/*
API for accessing the specified repositories
If default is used, will use the ReVanced API
*/
TextField(
controller: _hostSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.extension_outlined,
color: Theme.of(context).colorScheme.secondary,
decoration: InputDecoration(
icon: Icon(
Icons.rocket_launch_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.hostRepositoryLabel',
).toString(),
hintText: hostRepository,
),
inputController: _orgPatSourceController,
label: I18nText('settingsView.orgPatchesLabel'),
hint: patchesRepo.split('/')[0],
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 8),
CustomTextField(
leadingIcon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
inputController: _patSourceController,
label: I18nText('settingsView.sourcesPatchesLabel'),
hint: patchesRepo.split('/')[1],
// Patches owner's name
TextField(
controller: _orgPatSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.merge_outlined,
color: Theme.of(context).colorScheme.secondary,
decoration: InputDecoration(
icon: Icon(
Icons.extension_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.orgPatchesLabel',
).toString(),
hintText: patchesRepo.split('/')[0],
),
inputController: _orgIntSourceController,
label: I18nText('settingsView.orgIntegrationsLabel'),
hint: integrationsRepo.split('/')[0],
),
const SizedBox(height: 8),
// Patches repository's name
TextField(
controller: _patSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.sourcesPatchesLabel',
).toString(),
hintText: patchesRepo.split('/')[1],
),
),
const SizedBox(height: 8),
CustomTextField(
leadingIcon: const Icon(
Icons.merge_outlined,
color: Colors.transparent,
// Integrations owner's name
TextField(
controller: _orgIntSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: Icon(
Icons.merge_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.orgIntegrationsLabel',
).toString(),
hintText: integrationsRepo.split('/')[0],
),
inputController: _intSourceController,
label: I18nText('settingsView.sourcesIntegrationsLabel'),
hint: integrationsRepo.split('/')[1],
),
const SizedBox(height: 8),
// Integrations repository's name
TextField(
controller: _intSourceController,
autocorrect: false,
onChanged: (value) => notifyListeners(),
decoration: InputDecoration(
icon: const Icon(
Icons.merge_outlined,
color: Colors.transparent,
),
border: const OutlineInputBorder(),
labelText: I18nText(
'settingsView.sourcesIntegrationsLabel',
).toString(),
hintText: integrationsRepo.split('/')[1],
),
),
const SizedBox(height: 20),
I18nText('settingsView.sourcesUpdateNote'),
Expand Down
63 changes: 0 additions & 63 deletions lib/ui/widgets/settingsView/custom_switch.dart

This file was deleted.

32 changes: 0 additions & 32 deletions lib/ui/widgets/settingsView/custom_switch_tile.dart

This file was deleted.

Loading

0 comments on commit 9ed43ef

Please sign in to comment.