Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
refactor: upgrade packages and code
Browse files Browse the repository at this point in the history
  • Loading branch information
ethicnology committed Jun 6, 2024
1 parent b7b3820 commit 16116e3
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 73 deletions.
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ void main() {
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand Down
34 changes: 17 additions & 17 deletions lib/screen/create_secret.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class CreateSecretScreen extends StatefulWidget {

class _CreateSecretScreenState extends State<CreateSecretScreen> {
final _formKey = GlobalKey<FormState>();
bool hasPassphrase = false;
TextEditingController secret = TextEditingController();
TextEditingController passphrase = TextEditingController();
TextEditingController shares = TextEditingController();
TextEditingController threshold = TextEditingController();
var random = Random.secure();
final secret = TextEditingController();
final passphrase = TextEditingController();
final shares = TextEditingController();
final threshold = TextEditingController();
final random = Random.secure();
var hasPassphrase = false;

@override
void dispose() {
Expand All @@ -47,7 +47,8 @@ class _CreateSecretScreenState extends State<CreateSecretScreen> {
padding: const EdgeInsets.only(top: 8, bottom: 3),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.teal, backgroundColor: Colors.white,
foregroundColor: Colors.teal,
backgroundColor: Colors.white,
),
onPressed: () {
var randomValues = List<int>.generate(
Expand All @@ -67,8 +68,9 @@ class _CreateSecretScreenState extends State<CreateSecretScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const DisclaimerScreen()),
builder: (context) =>
const DisclaimerScreen(),
),
);
},
),
Expand Down Expand Up @@ -98,13 +100,10 @@ class _CreateSecretScreenState extends State<CreateSecretScreen> {
color: Colors.teal,
child: Column(children: [
SwitchListTile(
title: const Text('Passphrase ?'),
value: hasPassphrase,
onChanged: (bool value) {
setState(() {
hasPassphrase = value;
});
}),
title: const Text('Passphrase ?'),
value: hasPassphrase,
onChanged: (v) => setState(() => hasPassphrase = v),
),
if (hasPassphrase)
Padding(
padding: const EdgeInsets.all(7),
Expand Down Expand Up @@ -172,7 +171,8 @@ class _CreateSecretScreenState extends State<CreateSecretScreen> {
padding: const EdgeInsets.only(top: 3),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.teal, backgroundColor: Colors.white,
foregroundColor: Colors.teal,
backgroundColor: Colors.white,
),
onPressed: () {
if (_formKey.currentState!.validate()) {
Expand Down
6 changes: 3 additions & 3 deletions lib/screen/disclaimer.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import 'package:flutter/material.dart';

class DisclaimerScreen extends StatelessWidget {
const DisclaimerScreen({Key? key}) : super(key: key);
const DisclaimerScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Disclaimer')),
body: SingleChildScrollView(
body: const SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
children: [
Padding(
padding: EdgeInsets.all(20),
child: Center(
Expand Down
32 changes: 15 additions & 17 deletions lib/screen/recover_secret.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:subterfuge/screen/secret.dart';
import 'package:slip39/slip39.dart';

class RecoverSecretScreen extends StatefulWidget {
const RecoverSecretScreen({Key? key}) : super(key: key);
const RecoverSecretScreen({super.key});

@override
State<RecoverSecretScreen> createState() => _RecoverSecretScreenState();
Expand Down Expand Up @@ -71,18 +71,16 @@ class _RecoverSecretScreenState extends State<RecoverSecretScreen> {
}),
if (hasPassphrase)
Padding(
padding: const EdgeInsets.all(7),
child: TextFormField(
enableSuggestions: false,
autocorrect: false,
onChanged: (String value) {
setState(() {
passphrase = value;
});
},
decoration: const InputDecoration(
labelText: 'Passphrase'),
)),
padding: const EdgeInsets.all(7),
child: TextFormField(
enableSuggestions: false,
autocorrect: false,
onChanged: (v) =>
setState(() => passphrase = v),
decoration: const InputDecoration(
labelText: 'Passphrase'),
),
),
])),
if (nbShares > 0)
for (int i = 0; i < nbShares; i++)
Expand All @@ -109,7 +107,8 @@ class _RecoverSecretScreenState extends State<RecoverSecretScreen> {
))),
ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.teal, backgroundColor: Colors.white,
foregroundColor: Colors.teal,
backgroundColor: Colors.white,
),
onPressed: () {
if (_formKey.currentState!.validate()) {
Expand All @@ -121,9 +120,8 @@ class _RecoverSecretScreenState extends State<RecoverSecretScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecretScreen(
secret: secret,
),
builder: (context) =>
SecretScreen(secret: secret),
));
}
},
Expand Down
2 changes: 1 addition & 1 deletion lib/widget/disclaimer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:subterfuge/screen/disclaimer.dart';

class DisclaimerWidget extends StatelessWidget {
const DisclaimerWidget({Key? key}) : super(key: key);
const DisclaimerWidget({super.key});

@override
Widget build(BuildContext context) {
Expand Down
62 changes: 31 additions & 31 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: archive
sha256: "793964beb8e297995714326628881437d4211f10fc8843534bab54129cd896ee"
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
url: "https://pub.dev"
source: hosted
version: "3.3.1"
version: "3.6.1"
args:
dependency: transitive
description:
name: args
sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.5.0"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -45,18 +45,18 @@ packages:
dependency: transitive
description:
name: checked_yaml
sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c"
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
url: "https://pub.dev"
source: hosted
version: "0.3.5"
version: "0.4.1"
clock:
dependency: transitive
description:
Expand All @@ -77,18 +77,18 @@ packages:
dependency: "direct main"
description:
name: convert
sha256: "196284f26f69444b7f5c50692b55ec25da86d9e500451dc09333bf2e3ad69259"
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.1.1"
crypto:
dependency: transitive
description:
name: crypto
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.3"
fake_async:
dependency: transitive
description:
Expand All @@ -106,18 +106,18 @@ packages:
dependency: "direct dev"
description:
name: flutter_launcher_icons
sha256: a9de6706cd844668beac27c0aed5910fa0534832b3c2cad61a5fd977fce82a5d
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.10.0"
version: "0.13.1"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "4.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -127,18 +127,18 @@ packages:
dependency: transitive
description:
name: image
sha256: "9d2c5f73435a70a936d317769ee8e7ef480e37674b9f2bce95ea98969a307855"
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "4.2.0"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: cb314f00b2488de7bc575207e54402cd2f92363f333a7933fd1b0631af226baa
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.6.0"
version: "4.9.0"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -167,10 +167,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "5cfd6509652ff5e7fe149b6df4859e687fca9048437857cb2e65c8d780f396e3"
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "4.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -207,10 +207,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71"
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "6.0.2"
pinenacl:
dependency: transitive
description:
Expand Down Expand Up @@ -284,10 +284,10 @@ packages:
dependency: transitive
description:
name: typed_data
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "1.3.2"
vector_math:
dependency: transitive
description:
Expand All @@ -308,18 +308,18 @@ packages:
dependency: transitive
description:
name: xml
sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "6.5.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
sdks:
dart: ">=3.4.0 <4.0.0"
dart: ">=3.4.0 <=3.22.1"
flutter: ">=3.18.0-18.0.pre.54"
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0

environment:
sdk: ">=2.17.3 <3.0.0"
sdk: ">=2.17.3 <=3.22.1"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand All @@ -23,8 +23,8 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_launcher_icons: ^0.10.0
flutter_lints: ^4.0.0
flutter_launcher_icons: ^0.13.1

# The following section is specific to Flutter packages.
flutter:
Expand Down

0 comments on commit 16116e3

Please sign in to comment.