Skip to content

Commit

Permalink
home.dart UI complete
Browse files Browse the repository at this point in the history
  • Loading branch information
gokulmanohar committed Dec 3, 2020
1 parent 5fc0081 commit 5691613
Show file tree
Hide file tree
Showing 16 changed files with 398 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies

Large diffs are not rendered by default.

61 changes: 34 additions & 27 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by pub on 2020-12-02 09:23:41.351370.
# Generated by pub on 2020-12-02 19:58:29.749878.
archive:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib/
args:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
async:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.4.2/lib/
Expand Down
Binary file modified android/.gradle/6.3/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified android/.gradle/6.3/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified android/.gradle/6.3/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified android/.gradle/6.3/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified android/.gradle/6.3/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
8 changes: 3 additions & 5 deletions lib/ui/landing/activity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:intl/intl.dart';
import 'home/loading_widget.dart';

class Activity extends StatelessWidget {
@override
Expand All @@ -20,9 +21,7 @@ class Activity extends StatelessWidget {
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: Text("Loading"),
);
return LoadingWidget();
} else if (!snapshot.hasData) {
return Center(
child: Text("Couldn't connect to the server."),
Expand Down Expand Up @@ -51,8 +50,7 @@ class Activity extends StatelessWidget {
flex: 1,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: pdfThumbnailBorder)),
border: Border.all(color: pdfThumbnailBorder)),
child: Image.network(
listOfPdf.data()['image'],
fit: BoxFit.cover,
Expand Down
153 changes: 50 additions & 103 deletions lib/ui/landing/home.dart
Original file line number Diff line number Diff line change
@@ -1,122 +1,69 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'home/carousel_slider.dart';
import 'home/action_chip.dart';
import 'home/featured_notes.dart';
import 'home/pinned_notes.dart';

class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color carouselSliderFill = Colors.grey[300];
Color actionChipBackground = Colors.grey[300];
var brightness = MediaQuery.of(context).platformBrightness;
bool darkModeOn = brightness == Brightness.dark;
if (darkModeOn == true) {
carouselSliderFill = Colors.grey[900];
actionChipBackground = Colors.grey[900];
}
return Scaffold(
body: ListView(
children: <Widget>[
Column(
children: [
StreamBuilder(
stream: FirebaseFirestore.instance
.collection('CarouselSlider')
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: Text("Loading"),
);
} else if (!snapshot.hasData) {
return Center(
child: Text("Couldn't connect to the server."),
);
} else {
return Container(
color: carouselSliderFill,
padding: EdgeInsets.all(6.0),
child: CarouselSlider.builder(
options: CarouselOptions(
height: 200.0,
viewportFraction: 1.0,
autoPlay: true,
autoPlayInterval: Duration(seconds: 30),
enableInfiniteScroll: false,
),
itemCount: snapshot.data.docs.length,
itemBuilder: (context, position) {
DocumentSnapshot images =
snapshot.data.docs[position];
return Container(
child: GestureDetector(
onTap: () =>
_launchURL(images.data()['ExternalURL']),
child: Image.network(
images.data()['ImagePath'],
fit: BoxFit.fill,
),
),
);
}),
);
}
}),
Container(
margin: EdgeInsets.all(8.0),
height: 50,
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('ActionChips')
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: Text("Loading."),
);
} else if (!snapshot.hasData) {
return Center(
child: Text("Couldn't connect to the server."),
);
} else {
return new Expanded(
child: ListView.builder(
shrinkWrap: true,
physics: ClampingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: snapshot.data.documents.length,
itemBuilder: (context, position) {
DocumentSnapshot chips =
snapshot.data.docs[position];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: ActionChip(
backgroundColor: actionChipBackground,
label: Text(chips.data()['Label']),
onPressed: () {
print("Chip Pressed");
}),
),
);
}),
);
}
}),
// CarouselSlider
CarouselSliderBuilder(),

// ActionChip
ActionChipBuilder(),

// FeaturedNotes
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Featured notes",
style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w500)),
GestureDetector(
// onTap: () =>,
child: Text("See more",
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w400,
color: Colors.deepOrangeAccent)))
],
),
),
FeaturedNotesBuilder(),

// PinnedNotes
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Pinned notes",
style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w500)),
GestureDetector(
// onTap: () =>,
child: Text("See more",
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w400,
color: Colors.deepOrangeAccent)))
],
),
),
PinnedNotesBuilder(),
],
),
],
),
);
}
}

_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
Loading

0 comments on commit 5691613

Please sign in to comment.