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

course_detials_screen #12

Open
wants to merge 3 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
56 changes: 0 additions & 56 deletions lib/compenents/article_container.dart

This file was deleted.

43 changes: 0 additions & 43 deletions lib/compenents/article_list.dart

This file was deleted.

57 changes: 57 additions & 0 deletions lib/compenents/item_container.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';

class ItemContainer extends StatelessWidget {
const ItemContainer({
Key? key,
required this.date,
required this.imageUrl,
required this.title,
}) : super(key: key);
final String title;
final String date;
final String imageUrl;

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(20.0),
width: double.infinity,
height: MediaQuery.of(context).size.height / 5,
child: Row(children: [
Container(
width: MediaQuery.of(context).size.width / 3,
margin: const EdgeInsets.only(right: 30.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.network(
imageUrl,
errorBuilder: (context, error, stackTrace) => Container(),
),
),
),
Container(
margin: const EdgeInsets.only(top: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
color: Color(0xFFBA0C2F),
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 15.0,
),
Text(
date,
style: const TextStyle(color: Colors.white),
)
],
),
)
]),
);
}
}
31 changes: 31 additions & 0 deletions lib/compenents/list_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';

import 'item_container.dart';

// ignore: must_be_immutable
class IeeeListView extends StatelessWidget {
const IeeeListView({Key? key, required this.items}) : super(key: key);
final List<dynamic> items;

@override
Widget build(BuildContext context) {
return Container(
color: Colors.black,
child: ListView.separated(
itemCount: items.length,
itemBuilder: (context, index) => ItemContainer(
title: items[index].title,
imageUrl: items[index].imageUrl,
date: items[index].date.toString().substring(0, 10),
),
separatorBuilder: (context, index) => Center(
child: Container(
height: 1.0,
width: 350,
color: Colors.grey[300],
),
),
),
);
}
}
57 changes: 57 additions & 0 deletions lib/compenents/list_view_container.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';

class ArticleContainer extends StatelessWidget {
const ArticleContainer(
{Key? key,
required this.date,
this.imageUrl,
this.title,
required this.nextScreen})
: super(key: key);
final String? title;
final String date;
final String? imageUrl;
final Widget nextScreen;

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(20.0),
width: double.infinity,
height: MediaQuery.of(context).size.height / 5,
child: Row(children: [
Container(
margin: const EdgeInsets.only(right: 30.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
// ignore: prefer_const_constructors
child: Image(image: AssetImage('assets/article_image.jpeg')),
),
),
Container(
margin: const EdgeInsets.only(top: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title!,
style: const TextStyle(
color: Color(0xFFBA0C2F),
fontSize: 30.0,
fontWeight: FontWeight.bold),
),
const SizedBox(
height: 15.0,
),
Text(
date,
//date,
style: const TextStyle(color: Colors.white),
)
],
),
)
]),
);
}
}
65 changes: 5 additions & 60 deletions lib/compenents/side_bar.dart
Original file line number Diff line number Diff line change
@@ -1,76 +1,21 @@
import 'package:app/compenents/side_box.dart';
import 'package:app/data/data.dart';
import 'package:app/compenents/side_boxes.dart';
import 'package:app/data/ui_provider.dart';
import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import '../screens/article_list_screen.dart';

class SideBar extends StatelessWidget {
const SideBar({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
bool isClicked = false;
bool providerIsClicked = Provider.of<Data>(context).isOpened;
Widget unOpenedBoxes = GestureDetector(
onTap: () {
if (Provider.of<Data>(context, listen: false).isOpened == false) {
isClicked = true;
} else {
isClicked = false;
}
Provider.of<Data>(context, listen: false).changeIsOpened(isClicked);
},
child: Column(children: [
SideBox(
onTap: () {
if (Provider.of<Data>(context, listen: false).isOpened == false) {
isClicked = true;
} else {
isClicked = false;
}
Provider.of<Data>(context, listen: false)
.changeIsOpened(isClicked);
},
boxColor: const Color(0xFF4200CF),
icon: Icons.home,
iconColor: Colors.white,
title: "Home",
titleColor: Colors.white,
),
SideBox(
onTap: (() => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ArticleListScreen()))),
icon: Icons.article,
title: "Article",
),
const SideBox(
icon: Icons.login,
title: "Login",
),
const SideBox(
icon: Icons.event,
title: "Events",
),
const SideBox(
icon: Icons.image,
title: "Gallery",
),
const SideBox(
icon: Icons.info,
title: "About us",
)
]));
bool uiProvider = Provider.of<UiProvider>(context).isClicked;

final double width = MediaQuery.of(context).size.width;
final double height = MediaQuery.of(context).size.height;

return AnimatedContainer(
duration: const Duration(milliseconds: 150),
width: providerIsClicked ? width / 2.3 : 65,
width: uiProvider ? width / 2.3 : 65,
height: height,
child: Container(
height: height,
Expand All @@ -85,7 +30,7 @@ class SideBar extends StatelessWidget {
bottomRight: Radius.circular(20.0),
),
color: Color(0xFF880000)),
child: unOpenedBoxes,
child: const SideBoxesColumn(),
),
);
}
Expand Down
52 changes: 52 additions & 0 deletions lib/compenents/side_boxes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:app/compenents/side_box.dart';
import 'package:app/data/ui_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../screens/article_list_view_screen.dart';
import '../screens/course_list_view_screen.dart';

class SideBoxesColumn extends StatelessWidget {
const SideBoxesColumn({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final uiProvider = Provider.of<UiProvider>(context);
return Column(children: [
SideBox(
onTap: () {
uiProvider.toggleSideBar();
},
boxColor: const Color(0xFF4200CF),
icon: Icons.home,
iconColor: Colors.white,
title: "Home",
titleColor: Colors.white,
),
SideBox(
onTap: (() => Navigator.push(context,
MaterialPageRoute(builder: (context) => const ArticleListView()))),
icon: Icons.article,
title: "Article",
),
SideBox(
onTap: (() => Navigator.push(context,
MaterialPageRoute(builder: (context) => const CourseListView()))),
icon: Icons.monitor,
title: "Courses",
),
const SideBox(
icon: Icons.event,
title: "Events",
),
const SideBox(
icon: Icons.login,
title: "Login",
),
const SideBox(
icon: Icons.info,
title: "About us",
)
]);
}
}
Loading