diff --git a/android/settings_aar.gradle b/android/settings_aar.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/android/settings_aar.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/lib/constants.dart b/lib/constants.dart index fc10903..4e27a4a 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -1,3 +1,3 @@ -final bool debugRelease = false; +final bool debugRelease = true; //final String testingServer = "https://test.covid-19.health.gov.lk/api"; final String testingServer = "https://test.covid-19.health.gov.lk/api"; diff --git a/lib/page/screen/dashboard_screen.dart b/lib/page/screen/dashboard_screen.dart index 1905350..c7f4a33 100644 --- a/lib/page/screen/dashboard_screen.dart +++ b/lib/page/screen/dashboard_screen.dart @@ -75,9 +75,7 @@ class _DashboardScreenState extends State SharedPreferences prefs = await SharedPreferences.getInstance(); bool forceUpdate = true; - print("Fetching the articles"); int id = await ApiClient().getLastMessageId(); - print("last fetched $id"); int lowerID = 1; if (id >= 10) { lowerID = id - 9; @@ -132,7 +130,7 @@ class _DashboardScreenState extends State AppLocalizations.of(context).locale == Locale("ta", "TA") ? 100 : 60, - ) + ), ]; }, body: TabBarView( @@ -189,9 +187,6 @@ class _DashboardScreenState extends State } Widget _createNewsArticle(NewsArticle article) { - print( - "${article.id} ${article.title},${article.message} ${article.created}"); - Icon _icon = Icon( Icons.info, color: Colors.blue, @@ -357,7 +352,7 @@ class _DashboardScreenState extends State figure, style: TextStyle( fontWeight: FontWeight.bold, - fontSize: 20.0, + fontSize: 23.0, color: colorCode), ), ), @@ -369,7 +364,77 @@ class _DashboardScreenState extends State Widget _buildNewsScreen() { return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: FutureBuilder( + future: _articleFetch, + builder: (context, snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.none: + return Center( + child: Text("An error has occured, try again"), + ); + break; + case ConnectionState.waiting: + return Center( + child: CircularProgressIndicator(), + ); + break; + case ConnectionState.active: + return Center( + child: Text("An error has occured, try again"), + ); + break; + case ConnectionState.done: + return Consumer( + builder: (context, model, child) { + List stories = model.articles; + return ListView.builder( + itemCount: stories.length + 1, + itemBuilder: (BuildContext context, int index) { + if (index == 0) { + return _buildTopStats(); + } else + return _createNewsArticle(stories[index - 1]); + }); + }, + ); + break; + default: + return Center( + child: CircularProgressIndicator(), + ); + } + }, + ), + ), + ], + ); + } + + Widget _buildTopStats() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Padding( + // padding: const EdgeInsets.only(left: 15, top: 20.0), + // child: Text("ONGOING:", + // textAlign: TextAlign.start, + // style: TextStyle( + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 15.0)), + // ), + // Padding( + // padding: const EdgeInsets.only(left: 15), + // child: Text("COVID-19 Statistics", + // textAlign: TextAlign.start, + // style: TextStyle( + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 30.0)), + // ), Container( width: double.maxFinite, height: MediaQuery.of(context).size.height / @@ -380,19 +445,37 @@ class _DashboardScreenState extends State padding: const EdgeInsets.all(10.0), child: Row( children: [ - _createCountCard( - AppLocalizations.of(context) - .translate("dashboard_confirmed_card_text"), - "$confirmed", - Color(0XFFc53030), - width: MediaQuery.of(context).size.width / 4, + Expanded( + child: Column( + children: [ + Expanded( + child: Container( + width: double.maxFinite, + height: MediaQuery.of(context).size.height / 2, + child: _createCountCard( + AppLocalizations.of(context) + .translate("dashboard_confirmed_card_text"), + "$confirmed", + Color(0XFFc53030), + width: MediaQuery.of(context).size.width / 4, + ), + ), + ), + Expanded( + child: Container( + width: double.maxFinite, + height: MediaQuery.of(context).size.height / 2, + child: _createCountCard( + AppLocalizations.of(context) + .translate("dashboard_suspected_card_text"), + "$suspected", + Color(0XFFed8936), + width: MediaQuery.of(context).size.width / 4), + ), + ), + ], + ), ), - _createCountCard( - AppLocalizations.of(context) - .translate("dashboard_suspected_card_text"), - "$suspected", - Color(0XFFed8936), - width: MediaQuery.of(context).size.width / 4), Expanded( child: Column( children: [ @@ -437,47 +520,6 @@ class _DashboardScreenState extends State ), ), ), - Expanded( - child: FutureBuilder( - future: _articleFetch, - builder: (context, snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.none: - return Center( - child: Text("An error has occured, try again"), - ); - break; - case ConnectionState.waiting: - return Center( - child: CircularProgressIndicator(), - ); - break; - case ConnectionState.active: - return Center( - child: Text("An error has occured, try again"), - ); - break; - case ConnectionState.done: - return Consumer( - builder: (context, model, child) { - print("CHANGED: ${model.articles.length}"); - List stories = model.articles; - return ListView.builder( - itemCount: stories.length, - itemBuilder: (BuildContext context, int index) { - return _createNewsArticle(stories[index]); - }); - }, - ); - break; - default: - return Center( - child: CircularProgressIndicator(), - ); - } - }, - ), - ), ], ); } diff --git a/lib/page/screen/news_detail_screen.dart b/lib/page/screen/news_detail_screen.dart index e64d98d..19725ee 100644 --- a/lib/page/screen/news_detail_screen.dart +++ b/lib/page/screen/news_detail_screen.dart @@ -28,6 +28,7 @@ class _NewsDetailScreenState extends State { @override void initState() { super.initState(); + print(widget.article.message); } void _shareArticle(NewsArticle article) { @@ -90,75 +91,85 @@ class _NewsDetailScreenState extends State { ), body: Container( child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.max, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: Text( - widget.article.title, - textAlign: TextAlign.start, - style: Theme.of(context).textTheme.title.copyWith( - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "By ${widget.article.originator}", - textAlign: TextAlign.start, - style: Theme.of(context) - .textTheme - .body1 - .copyWith(fontSize: 12), - ), - Spacer(), - Text( - "${dateFormat.format(widget.article.created)}", - //published data needs to facilitated into the messages from the API - style: Theme.of(context) - .textTheme - .body1 - .copyWith(fontSize: 12), - ), - ], - ), - ], - ) - ], - ), - SizedBox( - height: 20, - ), - SingleChildScrollView( - child: Html( - data: widget.article.message, - shrinkToFit: true, - customTextAlign: (val) { - return TextAlign.justify; - }, - ), - ) - ], - ), - ))); + padding: const EdgeInsets.all(0.0), + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + widget.article.title, + textAlign: TextAlign.start, + style: Theme.of(context) + .textTheme + .title + .copyWith( + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "By ${widget.article.originator}", + textAlign: TextAlign.start, + style: Theme.of(context) + .textTheme + .body1 + .copyWith(fontSize: 12), + ), + Spacer(), + Text( + "${dateFormat.format(widget.article.created)}", + //published data needs to facilitated into the messages from the API + style: Theme.of(context) + .textTheme + .body1 + .copyWith(fontSize: 12), + ), + ], + ), + ], + ) + ], + ), + SizedBox( + height: 20, + ), + Html( + data: widget.article.message, + shrinkToFit: false, + customTextAlign: (val) { + return TextAlign.justify; + }, + ), + ], + ), + ), + )))); } + + // var testhtml = + // "
\n

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Why do we use it?

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here',

  1. one
  2. two
  3. three

\n
"; + } diff --git a/pubspec.yaml b/pubspec.yaml index 694ba33..2c0b85d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Self tracking app # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.11.0+26 +version: 1.10.0+25 environment: sdk: ">=2.1.0 <3.0.0" @@ -45,11 +45,9 @@ dependencies: auto_size_text: ^2.1.0 flutter_html: ^0.11.1 - flutter_localizations: sdk: flutter - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2