From 4e736501f613cd21829752d8ca67585d731a8f66 Mon Sep 17 00:00:00 2001 From: Aldrin Zigmund Cortez Velasco Date: Mon, 9 Oct 2023 04:47:42 +0800 Subject: [PATCH] minor UI improvements, optimization and code refactorin --- android/app/build.gradle | 4 +- assets/icons/librum.png | Bin 3116 -> 3072 bytes lib/data/categories.dart | 2 - lib/data/verses.dart | 2 +- lib/main.dart | 19 ++--- lib/pages/donate.dart | 57 --------------- lib/pages/donationpage.dart | 67 +++++++++++++++++ lib/pages/home.dart | 125 ------------------------------- lib/pages/homepage.dart | 142 ++++++++++++++++++++++++++++++++++++ lib/pages/loadingpage.dart | 63 ++++++++++++++++ lib/pages/versespage.dart | 50 ++++++++----- pubspec.lock | 38 +++++----- pubspec.yaml | 72 +----------------- 13 files changed, 339 insertions(+), 302 deletions(-) delete mode 100644 lib/pages/donate.dart create mode 100644 lib/pages/donationpage.dart delete mode 100644 lib/pages/home.dart create mode 100644 lib/pages/homepage.dart create mode 100644 lib/pages/loadingpage.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index c2d25a1..e2da573 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,8 +56,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 24 targetSdkVersion 33 - versionCode 2 - versionName "2.0.0" + versionCode 3 + versionName "2.5.0" } signingConfigs { diff --git a/assets/icons/librum.png b/assets/icons/librum.png index 28bfaa36f3bee02b81fba663db6be7e469b7c770..1831924476dc7d16d6749c0802fa9d86b0812f12 100644 GIT binary patch delta 2460 zcmV;N31jxG7=Rd%B!9w*bI$Mke*L?ghwraF=iTQ#w|TYm_6qm{U{XfZ0|1B)lR*pB zk_HHqfB_(XmKF5?E+{O{Q^o4pDqC8jl0`+DQ8q<|#d*pp$Wmr@avM7qPiSOdRQ=sU zx^nKix=#11y|G(o4s~jvXE>C9!}ax9=GD&I<3~M2I?9`xt*TA;t9tVSl`Wqo&x?AZ z&+-$#+8Z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_=Lv-@HD z`*#4rLI~P2c0J6I*BOeK=-Q;@ZpU7k(f8e#9LBo5rLBCbZ1Dr)Mn;xk_>9dTtyP!` zqKuCYVSaqVTp<1P|EPL|o1`G;=op@?l#luoKp~|v?)un&c-_g~Aa+$zSA6gJ&2d(o zn`+Lhg8IEvsTSg!FANAxd$f5*Jj<9(Nv(TyNJ&J5n#e6QQoI))(jPx={XBFO5no-u zwYT$PR|T{Jl%2299F3eiW2sOiyC*9RV1A`Aso2b6>_r`mXOhc&$jP4c5`5|P!22Vt z>bHKry3JKc+v!v~pk7`8#gIAzQ?*>*zo>15K4}KWG!;PAXbtmBmBKq3UMpXRrejSy2sDhBLQm}e?ZKBCNnBeP>_uiPD(q?Ic6nsfqP>pSI zap|QS)-9)*$Drfj$Gs#0xXIX!FKfT*?kw6&_2-)$+~#_G80e_y%Z3;g>Q6S#T^rw- z;_XydBD9Rwy6K*I&n~H)4LKix3!JH)lotTxJFJ11dXT&T0Byp6CpkzomRu`p0&R8K YRj{Zzm!v1jbpfD-wYp?kbKW!IzunyWBme*a diff --git a/lib/data/categories.dart b/lib/data/categories.dart index 2255480..78732ac 100644 --- a/lib/data/categories.dart +++ b/lib/data/categories.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -//Holds the App Drawer data which includes all verse categories - class CategoryEntry { String name; IconData icon; diff --git a/lib/data/verses.dart b/lib/data/verses.dart index c9926ea..63e7e1b 100644 --- a/lib/data/verses.dart +++ b/lib/data/verses.dart @@ -118,7 +118,7 @@ class Verses { Verse(category: "Sacrifice", verse: "Mark 10:45", text: "For even the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many.”"), Verse(category: "Sacrifice", verse: "Matthew 16:24", text: "Then Jesus said to his disciples, “Whoever wants to be my disciple must deny themselves and take up their cross and follow me."), Verse(category: "Sacrifice", verse: "1 Peter 2:21", text: "To this you were called, because Christ suffered for you, leaving you an example, that you should follow in his steps."), - Verse(category: "Sacrifice", verse: "Romans 12:1-2", text: "Therefore, I urge you, brothers and sisters, in view of God’s mercy, to offer your bodies as a living sacrifice, holy and pleasing to God—this is your true and proper worship. 2 Do not conform to the pattern of this world, but be transformed by the renewing of your mind. Then you will be able to test and approve what God’s will is—his good, pleasing and perfect will."), + Verse(category: "Sacrifice", verse: "Romans 12:1-2", text: "Therefore, I urge you, brothers and sisters, in view of God’s mercy, to offer your bodies as a living sacrifice, holy and pleasing to God—this is your true and proper worship. Do not conform to the pattern of this world, but be transformed by the renewing of your mind. Then you will be able to test and approve what God’s will is—his good, pleasing and perfect will."), Verse(category: "Wealth", verse: "Luke 16:11", text: "So if you have not been trustworthy in handling worldly wealth, who will trust you with true riches?"), Verse(category: "Wealth", verse: "Matthew 6:19-21", text: "“Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal. For where your treasure is, there your heart will be also."), diff --git a/lib/main.dart b/lib/main.dart index 064dd82..e005d24 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,16 +1,13 @@ import 'package:flutter/material.dart'; -import 'package:librum/pages/home.dart'; -import 'package:flutter/services.dart'; -import 'package:librum/data/verses.dart'; +import 'package:librum/pages/loadingpage.dart'; void main() { - - //initializes verses and getting random verse then passes it on to HomePage in home.dart - - Verses verses = Verses(); - - late int randomVerse = verses.getRandom(); - - runApp(HomePage(verses: verses, randomVerse: randomVerse)); + runApp(MaterialApp( + title: "Librum", + initialRoute: '/', + routes: { + '/': (context) => const LoadingPage(), + }, + )); } diff --git a/lib/pages/donate.dart b/lib/pages/donate.dart deleted file mode 100644 index 3bba26f..0000000 --- a/lib/pages/donate.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:librum/data/verses.dart'; - -//Builds the Donate Page - -class DonatePage extends StatelessWidget { - DonatePage({super.key}); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - backgroundColor: Colors.purple.shade700, - iconTheme: const IconThemeData(color: Colors.white), - title: Text("Donate", style: const TextStyle(color: Colors.white)), - ), - body: Center( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - child: Text( - "Donate XMR to Support this App", - style: TextStyle(fontSize: 21), - ), - margin: EdgeInsets.fromLTRB(0, 30.00, 0, 15.0)), - GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: - '86cQoPfKTJ2bRfGH5Ts2kzaXCRcVRiX8CUHKc9xmeUmQ8YM8Uzk9S97T5gQaqYu58C9wuFK7opDH7cM9EJyR4V5LAq9RGv4')); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text("Verse copied to clipboard."), - duration: Duration(seconds: 2), - )); - }, - child: Card( - child: Container( - child: Image.asset('assets/images/XMR.png'), - ), - ), - ), - Container( - child: Text( - "Tap the QR Code to get the XMR Wallet Address.", - style: TextStyle(fontSize: 15), - ), - margin: EdgeInsets.fromLTRB(0, 10.0, 0, 0)), - ], - ), - ), - ), - ); - } -} diff --git a/lib/pages/donationpage.dart b/lib/pages/donationpage.dart new file mode 100644 index 0000000..51099cd --- /dev/null +++ b/lib/pages/donationpage.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +//Builds the Donate Page + +class DonationPage extends StatelessWidget { + DonationPage({super.key}); + + copyMoneroAddress(context) { + Clipboard.setData(ClipboardData( + text: + '86cQoPfKTJ2bRfGH5Ts2kzaXCRcVRiX8CUHKc9xmeUmQ8YM8Uzk9S97T5gQaqYu58C9wuFK7opDH7cM9EJyR4V5LAq9RGv4')); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text("Verse copied to clipboard."), + duration: Duration(seconds: 2), + )); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + backgroundColor: Colors.purple.shade700, + iconTheme: const IconThemeData(color: Colors.white), + title: Text("Donate", style: const TextStyle(color: Colors.white)), + ), + backgroundColor: Colors.grey[50], + body: Center( + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(9.0), + child: Text( + "Donate XMR to Support this App", + style: TextStyle(fontSize: 21), + ), + ), + Padding( + padding: EdgeInsets.all(9.0), + child: GestureDetector( + onTap: () { + copyMoneroAddress(context); + }, + child: Card( + child: Padding( + padding: EdgeInsets.all(3.0), + child: Image.asset('assets/images/XMR.png'), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.all(9.0), + child: Text( + "Tap the QR Code to get the XMR Wallet Address.", + style: TextStyle(fontSize: 15), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/home.dart b/lib/pages/home.dart deleted file mode 100644 index 6799392..0000000 --- a/lib/pages/home.dart +++ /dev/null @@ -1,125 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -import 'package:librum/data/categories.dart'; -import 'package:librum/data/verses.dart'; -import 'package:librum/pages/donate.dart'; -import 'package:librum/pages/versespage.dart'; - -class HomePage extends StatelessWidget { - HomePage({super.key, required this.verses, required this.randomVerse}); - - //Will be used for a random verse in the home screen - late Verses verses; - late int randomVerse; - - //Verse categories that goes just below the random verse - CategoryEntries categoryEntries = CategoryEntries(); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Librum', - home: Builder( - builder: (context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.purple.shade700, - centerTitle: true, - title: Text( - 'Librum', - style: TextStyle(color: Colors.white), - ), - ), - backgroundColor: Colors.grey[50], - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - GestureDetector( - onTap: () { - Clipboard.setData(ClipboardData( - text: - '${verses.versesList[randomVerse].text} - ${verses.versesList[randomVerse].verse}')); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text("Verse copied to clipboard."), - duration: Duration(seconds: 2), - )); - }, - child: Padding( - padding: EdgeInsets.fromLTRB(9.0, 18.0, 9.0, 9.0), - child: Card( - child: ListTile( - title: Padding( - padding: EdgeInsets.all(9.0), - child: Text( - verses.versesList[randomVerse].text, - style: TextStyle(fontSize: 18.0), - )), - subtitle: Align( - alignment: Alignment.centerRight, - child: Padding( - padding: EdgeInsets.all(9.0), - child: Text(verses.versesList[randomVerse].verse)), - ), - subtitleTextStyle: TextStyle( - fontWeight: FontWeight.bold, - wordSpacing: 2.0, - fontSize: 15.0), - )), - ), - ), - Padding( - padding: EdgeInsets.all(9.0), - child: Text( - "Tap verses to copy to your clipboard.", - style: TextStyle(fontSize: 15), textAlign: TextAlign.center, - ), - ), - Padding( - padding: EdgeInsets.fromLTRB(9.0, 18.0, 9.0, 9.0), - child: Align( - alignment: Alignment.centerLeft, - child: Text( - 'Categories', - style: TextStyle(fontSize: 24.0), - ))), - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: categoryEntries.categoryList.length, - itemBuilder: (context, index) { - return Card( - child: ListTile( - leading: Icon( - categoryEntries.categoryList[index].icon, - color: Colors.deepPurple, - ), - title: Text(categoryEntries.categoryList[index].name), - onTap: () { - if (categoryEntries.categoryList[index].name != "Donate") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => VersesPage( - title: - categoryEntries.categoryList[index].name, - verses: verses))); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => DonatePage())); - } - }, - ), - ); - }) - ], - )), - ); - } - ), - ); - } -} diff --git a/lib/pages/homepage.dart b/lib/pages/homepage.dart new file mode 100644 index 0000000..deb2944 --- /dev/null +++ b/lib/pages/homepage.dart @@ -0,0 +1,142 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import 'package:librum/data/categories.dart'; +import 'package:librum/data/verses.dart'; +import 'package:librum/pages/donationpage.dart'; +import 'package:librum/pages/versespage.dart'; + +class HomePage extends StatefulWidget { + HomePage({super.key, required this.verses, required this.randomVerseIndex}); + + final Verses verses; + final int randomVerseIndex; + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + CategoryEntries categoryEntries = CategoryEntries(); + + late Verses verses; + late int randomVerse; + + copyRandomVerse() { + Clipboard.setData(ClipboardData( + text: + '${widget.verses.versesList[widget.randomVerseIndex].text} - ${widget.verses.versesList[widget.randomVerseIndex].verse}')); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text("Verse copied to clipboard."), + duration: Duration(seconds: 2), + )); + } + + goToVersesPage(index) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => VersesPage( + title: categoryEntries.categoryList[index].name, + verses: widget.verses))); + } + + goToDonationPage() { + Navigator.push( + context, MaterialPageRoute(builder: (context) => DonationPage())); + } + + @override + void initState() { + super.initState(); + verses = widget.verses; + randomVerse = widget.randomVerseIndex; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.purple.shade700, + centerTitle: true, + title: Text( + 'Librum', + style: TextStyle(color: Colors.white), + ), + ), + backgroundColor: Colors.grey[50], + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + GestureDetector( + onTap: () => copyRandomVerse(), + child: Padding( + padding: EdgeInsets.fromLTRB(9.0, 18.0, 9.0, 9.0), + child: Card( + child: Padding( + padding: EdgeInsets.all(9.0), + child: ListTile( + title: Text( + widget.verses.versesList[widget.randomVerseIndex].text, + style: TextStyle(fontSize: 18.0), + ), + subtitle: Align( + alignment: Alignment.centerRight, + child: Padding( + padding: EdgeInsets.all(9.0), + child: Text(widget + .verses.versesList[widget.randomVerseIndex].verse)), + ), + subtitleTextStyle: TextStyle( + fontWeight: FontWeight.bold, + wordSpacing: 2.0, + fontSize: 15.0), + ), + )), + ), + ), + Padding( + padding: EdgeInsets.all(9.0), + child: Text( + "Tap a verse to copy to your clipboard.", + style: TextStyle(fontSize: 15), + textAlign: TextAlign.center, + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(9.0, 18.0, 9.0, 9.0), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'Categories', + style: TextStyle(fontSize: 24.0), + ))), + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: categoryEntries.categoryList.length, + itemBuilder: (context, index) { + return Card( + child: ListTile( + leading: Icon( + categoryEntries.categoryList[index].icon, + color: Colors.deepPurple, + ), + title: Text(categoryEntries.categoryList[index].name), + onTap: () { + if (categoryEntries.categoryList[index].name != + "Donate") { + goToVersesPage(index); + } else { + goToDonationPage(); + } + }, + ), + ); + }) + ], + )), + ); + } +} diff --git a/lib/pages/loadingpage.dart b/lib/pages/loadingpage.dart new file mode 100644 index 0000000..e62c60d --- /dev/null +++ b/lib/pages/loadingpage.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; + +import 'package:librum/data/verses.dart'; + +import 'package:librum/pages/homepage.dart'; + +class LoadingPage extends StatefulWidget { + const LoadingPage({super.key}); + + @override + State createState() => _LoadingPageState(); +} + +class _LoadingPageState extends State { + late Verses verses; + late int randomVerseIndex; + + startup() async { + Future.delayed(const Duration(seconds: 1), () async { + verses = Verses(); + randomVerseIndex = verses.getRandom(); + goToHomePage(); + }); + } + + goToHomePage() { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => HomePage( + verses: verses, + randomVerseIndex: randomVerseIndex, + ))); + } + + @override + void initState() { + super.initState(); + startup(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.purple.shade700, + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(9.0), + child: Image.asset('assets/icons/librum.png')), + const Padding( + padding: EdgeInsets.all(9.0), + child: Text( + 'Librum', + style: TextStyle(color: Colors.white, fontSize: 27.0), + ), + ) + ], + ))); + } +} diff --git a/lib/pages/versespage.dart b/lib/pages/versespage.dart index 60f437c..456ee40 100644 --- a/lib/pages/versespage.dart +++ b/lib/pages/versespage.dart @@ -2,39 +2,53 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:librum/data/verses.dart'; -//Builds Pages for Verses using Verses() from data/verses.dart - -class VersesPage extends StatelessWidget { +class VersesPage extends StatefulWidget { VersesPage({super.key, required this.title, required this.verses}); - //Used to get the right Verse category for the AppBar and for the rest of the widgets to know what to display - //All possible values are in data/drawerentry.dart which appears in the app drawer also final String title; + final Verses verses; + @override + State createState() => _VersesPageState(); +} + +class _VersesPageState extends State { + late String title; late Verses verses; + copyVerse(index) { + Clipboard.setData(ClipboardData( + text: + '${widget.verses.get(widget.title)[index].text} - ${widget.verses.get(widget.title)[index].verse}')); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text("Verse copied to clipboard."), + duration: Duration(seconds: 2), + )); + } + + @override + void initState() { + super.initState(); + verses = widget.verses; + title = widget.title; + } + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, backgroundColor: Colors.purple.shade700, - iconTheme: const IconThemeData(color: Colors.white), - title: Text(title, style: const TextStyle(color: Colors.white)), + title: Text(widget.title, style: const TextStyle(color: Colors.white)), ), + backgroundColor: Colors.grey[50], body: ListView.builder( shrinkWrap: true, - itemCount: verses.get(title).length, + itemCount: widget.verses.get(widget.title).length, itemBuilder: (contex, index) { return GestureDetector( onTap: () { - Clipboard.setData(ClipboardData( - text: - '${verses.get(title)[index].text} - ${verses.get(title)[index].verse}')); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text("Verse copied to clipboard."), - duration: Duration(seconds: 2), - )); + copyVerse(index); }, child: Padding( padding: EdgeInsets.all(9.0), @@ -44,14 +58,16 @@ class VersesPage extends StatelessWidget { padding: EdgeInsets.all(9.0), child: ListTile( title: Text( - verses.get(title)[index].text, + widget.verses.get(widget.title)[index].text, style: TextStyle(fontSize: 18.0), ), subtitle: Align( alignment: Alignment.centerRight, child: Padding( padding: EdgeInsets.all(9.0), - child: Text(verses.get(title)[index].verse))), + child: Text(widget.verses + .get(widget.title)[index] + .verse))), subtitleTextStyle: TextStyle( fontWeight: FontWeight.bold, wordSpacing: 2.0, diff --git a/pubspec.lock b/pubspec.lock index f021d94..66817d2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.2" convert: dependency: transitive description: @@ -89,14 +89,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" fake_async: dependency: transitive description: @@ -151,18 +143,18 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: @@ -204,10 +196,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -244,10 +236,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.0" typed_data: dependency: transitive description: @@ -264,6 +256,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" xml: dependency: transitive description: @@ -281,4 +281,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c095b47..caa4eff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,41 +1,16 @@ name: librum description: A new Flutter project. -# 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 +publish_to: 'none' -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. -version: 2.0.0 +version: 2.5.0 environment: sdk: '>=3.0.6 <4.0.0' -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 - dev_dependencies: flutter_test: sdk: flutter @@ -59,51 +34,12 @@ flutter_launcher_icons: generate: true image_path: "assets/icons/librum.png" - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. flutter_lints: ^2.0.0 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: assets: - - assets/images/drawer.jpg - - assets/images/XMR.png - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + - assets/icons/librum.png + - assets/images/XMR.png \ No newline at end of file