flutter changes
This commit is contained in:
parent
d06b965dc1
commit
26dbda290e
2
web/repertory/.cspell/words.txt
Normal file
2
web/repertory/.cspell/words.txt
Normal file
@ -0,0 +1,2 @@
|
||||
cupertino
|
||||
cupertinoicons
|
1
web/repertory/.gitignore
vendored
1
web/repertory/.gitignore
vendored
@ -43,3 +43,4 @@ app.*.map.json
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
.flutter-companion
|
||||
|
6
web/repertory/lib/errors/duplicate_mount_exception.dart
Normal file
6
web/repertory/lib/errors/duplicate_mount_exception.dart
Normal file
@ -0,0 +1,6 @@
|
||||
class DuplicateMountException implements Exception {
|
||||
final String _name;
|
||||
const DuplicateMountException({required name}) : _name = name, super();
|
||||
|
||||
String get name => _name;
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'constants.dart' as constants;
|
||||
import 'package:repertory/constants.dart' as constants;
|
||||
import 'package:repertory/models/mount_list.dart';
|
||||
import 'package:repertory/widgets/mount_list_widget.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@ -16,7 +19,7 @@ class MyApp extends StatelessWidget {
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
|
||||
),
|
||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
home: const MyHomePage(title: constants.APP_TITLE),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -38,11 +41,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[const Text('TODO-Everything')],
|
||||
),
|
||||
body: ChangeNotifierProvider(
|
||||
create: (context) => MountList(),
|
||||
child: MountListWidget(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:repertory/errors/duplicate_mount_exception.dart';
|
||||
import 'package:repertory/types/mount_config.dart';
|
||||
|
||||
class MountList with ChangeNotifier {
|
||||
final List<MountConfig> _items = [MountConfig(name: "test")];
|
||||
|
||||
UnmodifiableListView get items => UnmodifiableListView(_items);
|
||||
|
||||
void add(MountConfig config) {
|
||||
MountConfig? item = _items.firstWhereOrNull(
|
||||
(cfg) => cfg.name == config.name,
|
||||
);
|
||||
if (item == null) {
|
||||
throw DuplicateMountException(name: config.name);
|
||||
}
|
||||
|
||||
_items.add(config);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
class MountConfig {
|
||||
final String _name;
|
||||
MountConfig({required name}) : _name = name;
|
||||
|
||||
String get name => _name;
|
||||
}
|
27
web/repertory/lib/widgets/mount_list_widget.dart
Normal file
27
web/repertory/lib/widgets/mount_list_widget.dart
Normal file
@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:repertory/models/mount_list.dart';
|
||||
import 'package:repertory/widgets/mount_widget.dart';
|
||||
|
||||
class MountListWidget extends StatefulWidget {
|
||||
const MountListWidget({super.key});
|
||||
|
||||
@override
|
||||
State<MountListWidget> createState() => _MountListWidgetState();
|
||||
}
|
||||
|
||||
class _MountListWidgetState extends State<MountListWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<MountList>(
|
||||
builder: (context, mountList, widget) {
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, idx) {
|
||||
return MountWidget(mountConfig: mountList.items[idx]);
|
||||
},
|
||||
itemCount: mountList.items.length,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
18
web/repertory/lib/widgets/mount_widget.dart
Normal file
18
web/repertory/lib/widgets/mount_widget.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:repertory/types/mount_config.dart';
|
||||
|
||||
class MountWidget extends StatelessWidget {
|
||||
final MountConfig mountConfig;
|
||||
const MountWidget({super.key, required this.mountConfig});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Container(
|
||||
height: 40,
|
||||
color: Colors.blue,
|
||||
child: Text(mountConfig.name),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -5,10 +5,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
||||
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
version: "2.12.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -34,7 +34,7 @@ packages:
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
collection:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||
@ -53,10 +53,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
||||
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.3"
|
||||
version: "1.3.2"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -79,10 +79,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
|
||||
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.9"
|
||||
version: "10.0.8"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -131,6 +131,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -139,6 +147,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: provider
|
||||
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@ -204,10 +220,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
||||
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.0.0"
|
||||
version: "14.3.1"
|
||||
sdks:
|
||||
dart: ">=3.7.0 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: repertory
|
||||
description: "A new Flutter project."
|
||||
description: "Repertory Management Portal"
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
@ -34,6 +34,8 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
collection: ^1.19.1
|
||||
provider: ^6.1.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
x
Reference in New Issue
Block a user