diff --git a/lib/Screens/Community/ACM/acm_descrption.dart b/lib/Screens/Community/ACM/acm_descrption.dart index c5e0409..8080f8a 100644 --- a/lib/Screens/Community/ACM/acm_descrption.dart +++ b/lib/Screens/Community/ACM/acm_descrption.dart @@ -21,7 +21,7 @@ class ACMDetailsPage extends StatefulWidget { } class _ACMDetailsPageState extends State { - bool read = false; // Add a state variable to manage read state + bool read = false; MyWidgets mywidget = const MyWidgets(); void toggleRead() { diff --git a/lib/Screens/Events/events.dart b/lib/Screens/Events/events.dart new file mode 100644 index 0000000..515128b --- /dev/null +++ b/lib/Screens/Events/events.dart @@ -0,0 +1,108 @@ + +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'dart:convert'; + +class UserForm extends StatefulWidget { + const UserForm({super.key}); + + @override + _UserFormState createState() => _UserFormState(); +} + +class _UserFormState extends State { + final _formKey = GlobalKey(); + final TextEditingController nameController = TextEditingController(); + final TextEditingController emailController = TextEditingController(); + final TextEditingController messageController = TextEditingController(); + + Future _submitData() async { + const String url = "https://sheet.best/api/sheets/YOUR_SHEET_ID"; + Map data = { + "Name": nameController.text, + "Email": emailController.text, + "Message": messageController.text, + }; + + try { + final response = await http.post( + Uri.parse(url), + headers: { + "Content-Type": "application/json", + }, + body: jsonEncode(data), + ); + + if (response.statusCode == 200) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Data submitted successfully')), + ); + } else { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Failed to submit data')), + ); + } + } catch (e) { + print(e); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Error: $e')), + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('User Data Form')), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Form( + key: _formKey, + child: Column( + children: [ + TextFormField( + controller: nameController, + decoration: const InputDecoration(labelText: 'Name'), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your name'; + } + return null; + }, + ), + TextFormField( + controller: emailController, + decoration: const InputDecoration(labelText: 'Email'), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter your email'; + } + return null; + }, + ), + TextFormField( + controller: messageController, + decoration: const InputDecoration(labelText: 'Message'), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter a message'; + } + return null; + }, + ), + const SizedBox(height: 20), + ElevatedButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + _submitData(); + } + }, + child: const Text('Submit'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/Screens/Home/home.dart b/lib/Screens/Home/home.dart index 8e02785..42deff8 100644 --- a/lib/Screens/Home/home.dart +++ b/lib/Screens/Home/home.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:omnia/Resources/Theme/theme.dart'; +import 'package:omnia/Screens/Events/events.dart'; import 'package:omnia/Screens/Home/events_desc.dart'; import 'package:omnia/Screens/Menu/menu.dart'; import 'package:omnia/cardvalues.dart'; @@ -138,7 +139,8 @@ class _MainHomeState extends State { ), InkWell( onTap: () { - launchUrlString(registerUrl); + // launchUrlString(registerUrl); + Navigator.push(context, MaterialPageRoute(builder: (context)=> const UserForm())); }, child: Container( height: 22, diff --git a/lib/cardvalues.dart b/lib/cardvalues.dart index 4967287..95430b8 100644 --- a/lib/cardvalues.dart +++ b/lib/cardvalues.dart @@ -237,35 +237,23 @@ List acmImages = [ - - - - - -// .......MEMBERS CARD VALUES........// - -// const membersCardNo = 5; - -// List initials = [ -// 'JD', -// 'AS', -// 'MS', -// 'LW', -// 'EJ', -// ]; - -// List usernames = [ -// 'john_doe', -// 'alice_smith', -// 'mark_sullivan', -// 'lisa_walker', -// 'eric_jones', -// ]; - -// List memberImages = [ -// "assets/profile1.png", -// "assets/profile2.png", -// "assets/profile3.png", -// "assets/profile4.png", -// "assets/profile5.png", -// ]; \ No newline at end of file +//...........EVENTS GSHEETS...........// + + +const _credentials = r''' +{ + "type": "service_account", + "project_id": "acm-events-432208",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X+BZj/bFiOAwu08nM8DgY5vJfITfovF5XHZD1AFtyCeVBAB\nQWDQGaSobtt447tf3bULmKyhqCethkmuVXAXpa3cMNXb/slX8dSlmaQDiSUTOpwE\nA4CBOLjSiQKBgC4nTSL8B0cV6cvwAMeWWPXNxUP714hK3GHVLYOIqkCV6Y8Y9U7y\nWpReDNiPMOb6JUvsFyILO4v/nOz4dn1Y6sV5MLyPgzd5uprdQbSuel9ILKfQs4zY\nDmu7Le+vGq3AkFWdcG7GyeUgn6tOMUJjyZ7xBQSPagLTFvLTlmBne/glAoGAQMnE\nSpQDK3Cirbkgxqc4Zem02xsP3kLnjbwGEX0sHUCg7wtb6mCNFTn4jr04V3EEeyft\nnRB0L2FZLXfDimnuGL5nB03UkPmjGb5to7WbTAC1OPRBqbDZFrqdKRIMyiio+JOn\n4EKfsyvxMCDGIXIFK2al4LXeyfcnS+esynkuGPkCgYALcA9wnW6eKhwnAkscbCJZ\naFovguNqvRDT0cAJMiS0wlu7HWU8c6CbI/ByyL1YEp2E3dEyFycE7712NH6iz4Al\nXh+la0gQP2GXD62z3nepjqZOCd6K1+ZqkdYyJRnfxeXO8PyJ3N/BWa4QSse1tqrQ\n0dZtWGc94nHcHAni5U7CVg==\n-----END PRIVATE KEY-----\n", + "client_email": "acm-events@acm-events-432208.iam.gserviceaccount.com", + "client_id": "105613303499758279713", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/acm-events%40acm-events-432208.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} +'''; + +const _spreadsheetId = '19Of0siGvy4yAKLrtxemmEmNpww2Dkxo5DC_gVrFOhEc'; \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index de6610c..cf5da48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _discoveryapis_commons: + dependency: transitive + description: + name: _discoveryapis_commons + sha256: "113c4100b90a5b70a983541782431b82168b3cae166ab130649c36eb3559d498" + url: "https://pub.dev" + source: hosted + version: "1.0.7" _flutterfire_internals: dependency: transitive description: @@ -320,6 +328,14 @@ packages: description: flutter source: sdk version: "0.0.0" + google_identity_services_web: + dependency: transitive + description: + name: google_identity_services_web + sha256: "5be191523702ba8d7a01ca97c17fca096822ccf246b0a9f11923a6ded06199b6" + url: "https://pub.dev" + source: hosted + version: "0.3.1+4" google_nav_bar: dependency: "direct main" description: @@ -328,6 +344,30 @@ packages: url: "https://pub.dev" source: hosted version: "5.0.6" + googleapis: + dependency: transitive + description: + name: googleapis + sha256: c2f311bcd1b3e4052234162edc6b626a9013a7e1385d6aad37e9e6a6c5f89908 + url: "https://pub.dev" + source: hosted + version: "11.4.0" + googleapis_auth: + dependency: transitive + description: + name: googleapis_auth + sha256: befd71383a955535060acde8792e7efc11d2fccd03dd1d3ec434e85b68775938 + url: "https://pub.dev" + source: hosted + version: "1.6.0" + gsheets: + dependency: "direct main" + description: + name: gsheets + sha256: "5730f2585d9df565f1cf54d8c26a3608c2586c5e1797932cb4484d5f1262e85b" + url: "https://pub.dev" + source: hosted + version: "0.5.0" http: dependency: transitive description: @@ -428,18 +468,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: @@ -468,18 +508,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.15.0" mime: dependency: transitive description: @@ -681,10 +721,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -769,10 +809,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "14.2.4" web: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index bd15b2c..c4571f3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: permission_handler: ^11.3.1 path_provider: ^2.1.3 crop_your_image: ^1.1.0 + gsheets: ^0.5.0 dev_dependencies: