Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc page made functional #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added notes/assets/icons/folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions notes/lib/components/folderCard.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:notes/constants/image_constants.dart';
import 'package:notes/model/folderData.dart';
class FolderCard extends StatelessWidget {
FolderCard({ this.data,this.isList}) ;
final bool isList;
final FolderData data;
final String str='Updated on : ';



@override
Widget build(BuildContext context) {

return Card(
elevation:8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(isList?12:6))),

child: Flex(
direction: isList?Axis.horizontal: Axis.vertical,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,



children: [
if(!isList)SizedBox(height: 5,width: 4,),
if(!isList)Image.asset(ImageConstants.kFolder,height: isList? 40: 80,),

Container(
color: isList? Colors.white:Color(0xffE6E6E6),
width: MediaQuery.of(context).size.width-50,


height: 54,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,

children: [
SizedBox(width: 4,),
if(isList)Image.asset(ImageConstants.kFolder,height: 32,),




Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

Text(
data.title,

style: TextStyle(
fontSize: isList?22:18,
fontWeight: FontWeight.bold,

),
),
Text(
isList?str+data.date:data.date,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700]

),
)
],
),
SizedBox(width: 2,),
SizedBox(width: 2,),

Icon(
Icons.more_vert,
color: Color(0xffDE6FA1),
)
],
),
)
],
),
);
}
}
1 change: 1 addition & 0 deletions notes/lib/constants/image_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ class ImageConstants {
static String kReportIssue='assets/icons/new_releases-24px.png';
static String kPrivacy='assets/icons/privacy_tip-24px.png';
static String kUpdate='assets/icons/system_update-24px.png';
static String kFolder='assets/icons/folder.png';

}
6 changes: 6 additions & 0 deletions notes/lib/model/folderData.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class FolderData {
String title;
String date;

FolderData({this.title, this.date});
}
114 changes: 112 additions & 2 deletions notes/lib/routes/documents.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,124 @@
import 'package:flutter/material.dart';
import 'package:notes/components/folderCard.dart';
import 'package:notes/components/header.dart';
import 'package:notes/constants/text_style_constants.dart';
import 'package:notes/model/folderData.dart';
class Documents extends StatefulWidget {
@override
_DocumentsState createState() => _DocumentsState();
}

class _DocumentsState extends State<Documents> {
List _list=[];
bool isList=true;// to check list view or grid view
@override
void initState() {
// TODO: implement initState
super.initState();


List data=[
FolderData(title:'Open source',date: '8 sep 2019'),
FolderData(title:'Open source',date: '15 sep 2019'),
FolderData(title:'Open source',date: '7 sep 2019'),
FolderData(title:'Open source',date: '9 sep 2019'),
FolderData(title:'Open source',date: '10 sep 2019'),

];// sample data
data.forEach((element) { _list.add(element);});// updating _list


}
@override
Widget build(BuildContext context) {
return Container(
child: Text('document'),
return Scaffold(
appBar: header(
Text('DOCUMENT', style: TextStyleConstants.kAppbarTextStyle),
SizedBox(width: 2,)
),
body: Padding(
padding: const EdgeInsets.only(left: 17,right: 17,top: 10),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,

children: [
Text(
'SUBJECT (${_list.length})',
style: TextStyle(
fontSize: 25,
color: Colors.black,
fontWeight: FontWeight.w500,
fontFamily: 'Manrope'

),
),
Row(
children: [
GestureDetector(
onTap:(){ if(!isList){setState(() {
isList=true;
});}},
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: isList?Color(0xFFb56eff):Colors.white



),
child: Icon(
Icons.view_agenda,
size: 25,
color: isList?Colors.white: Color(0xff67349C),
),
),
),
SizedBox(
width: 5.0
),
GestureDetector(
onTap: (){ if(isList){setState(() {
isList=false;
});}},
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: !isList?Color(0xFFb56eff):Colors.white



),
child: Icon(
Icons.view_module,
size: 25,
color: !isList?Colors.white: Color(0xff67349C),
),
),
),
],
)
],
),
SizedBox(height: 10,),
Flexible(
child: new GridView.count(
crossAxisCount: isList?1:2,
childAspectRatio: isList?3.5:1.0,
padding: const EdgeInsets.all(4.0),
mainAxisSpacing: 6.0,
crossAxisSpacing: 6.0,
children: _list.map((e) => FolderCard(isList: isList,data: e,)).toList(),
),
),
]),
)


);
}
}