Skip to content

task 3 #28

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

Open
wants to merge 2 commits into
base: main
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 Abhishek krishnan U V/assets/portfolioImage.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Abhishek krishnan U V/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

//News App UI by Abhishek krishnan U V
import 'package:flutter/material.dart';
import 'Screens/config/themes/themes.dart';
import 'Screens/details/detail_news.dart';

import 'Screens/home/home.dart';
import 'Screens/profile/profile.dart';


void main(){
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'NewsApp',
theme: Themes(),
debugShowCheckedModeBanner: false,
routes: {
Profile.routename: (ctx) => Profile(),
Homepage.routename: (ctx) => Homepage(),
DetailNews.routename: (ctx) => DetailNews(),
},
home: Homepage(),
);
}


}
16 changes: 16 additions & 0 deletions Abhishek krishnan U V/lib/screens/config/themes/themes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:flutter/material.dart';

ThemeData Themes() {
return ThemeData(
primarySwatch: Colors.blue,
textTheme: TextTheme(
bodyText1: TextStyle(color: Colors.black45)
),
primaryTextTheme: TextTheme(
headline4: TextStyle(color: Colors.blueGrey),
headline3: TextStyle(color: Colors.blueGrey, fontWeight: FontWeight.w600),
headline5: TextStyle(color: Colors.blueGrey),
bodyText1: TextStyle(color: Colors.blueGrey),
),
);
}
8 changes: 8 additions & 0 deletions Abhishek krishnan U V/lib/screens/config/var/var.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:newsapp_ui_by_abhishek/Screens/profile/profile.dart';

final String profileImage = 'https://images.unsplash.com/photo-1628260412297-a3377e45006f?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=774&q=80';
final String newspaperImage = 'https://images.unsplash.com/photo-1623934199716-dc28818a6ec7?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1032&q=80';
final String newspaperImage1 ='https://images.unsplash.com/photo-1632633173522-47456de71b76?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=871&q=80';
final String newspaperImage2 ='https://images.unsplash.com/photo-1606728035253-49e8a23146de?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=870&q=80';
final String newspaperImage3 ='https://images.unsplash.com/photo-1536924940846-227afb31e2a5?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=866&q=80';
final String newspaperImage4 ='https://images.unsplash.com/photo-1555680202-c86f0e12f086?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80';
44 changes: 44 additions & 0 deletions Abhishek krishnan U V/lib/screens/details/detail_news.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:newsapp_ui_by_abhishek/Screens/home/widgets/main_bar.dart';
import 'package:flutter/material.dart';

class DetailNews extends StatelessWidget {
static const routename = 'DetailNews';

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.share,
color: Colors.black,
),
),
],
leading: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black,
),
),
),
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [MainBar(), const SizedBox(height: 10), Text('China has continued with its crackdown on cryptocurrencies, resulting in a sharp fall in GPU prices in the country. The move has also plummetted Bitcoin value worldwide as crypto mining operations were halted.As reported by the state-owned publication, Global Times, Bitcoin mines in Southwest China’s Sichuan province were shut down on Sunday as local authorities ordered all mining operations in the region to stop last Friday. Authorities in other mining hubs in the north and southwest region have taken similar steps, which means over 90 percentage of China’s Bitcoin capacity can be shut down. ')],
),
),
)),
);
}
}
29 changes: 29 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/home.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'widgets/category_list.dart';
import 'widgets/custom_app_bar.dart';

import 'widgets/title_bar.dart';

class Homepage extends StatelessWidget {
static const routename = 'HomePage';

@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomAppBar(),
const Divider(thickness: 2,),
const CategoryList(),
const Divider(thickness: 2,),
TitleBar(screenWidth: screenWidth),

],
),
),
);
}
}
28 changes: 28 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/widgets/category_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return Container(
color: Colors.grey,
height: 55,
child: ListView(
scrollDirection: Axis.horizontal,
children: const [
Padding(
padding: EdgeInsets.all(12),
child: Text(' Top news',style: TextStyle(fontSize: 20,),),
),
Padding(
padding: EdgeInsets.all(12),
child: Text(' All',style: TextStyle(fontSize: 20,)),
),

],),
);
}
}
16 changes: 16 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/widgets/custom_app_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:newsapp_ui_by_abhishek/Screens/profile/profile.dart';
import 'package:flutter/material.dart';
import 'profile_pic.dart';

class CustomAppBar extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 8),
child: GestureDetector(
onTap: (){Navigator.of(context).pushNamed(Profile.routename);},
child: ProfilePic()),
);
}
}
48 changes: 48 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/widgets/main_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:newsapp_ui_by_abhishek/Screens/config/var/var.dart' as configvar;

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

@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Column(
children: [
ClipRRect(

child: Image.network(configvar.newspaperImage4),
),
const SizedBox(height: 10),
Container(
width: screenWidth * 0.8,
child: Text(
'GPU and Crypto prices fall sharply...........',
style: Theme.of(context).primaryTextTheme.headline5,
),
),
const SizedBox(height: 0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [


const SizedBox(width: 10),
Text(
'',
style: Theme.of(context).textTheme.bodyText1,
),
],
),

],
),
const Divider(thickness: 3),
],
);
}
}
82 changes: 82 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/widgets/news_tile.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:newsapp_ui_by_abhishek/Screens/config/var/var.dart' as configvar;

class CustomTile extends StatelessWidget {
const CustomTile({
Key? key,
required this.screenWidth,
}) : super(key: key);

final double screenWidth;

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 10),
child: Row(
children: [
Container(
height: 80,
width: 100,
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.network(
configvar.newspaperImage3,
fit: BoxFit.cover,
),
)),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: screenWidth * 0.5,
child: Text(
'Canon sued for 5 million dollars for disabling scanner when printers run out of ink',
style: Theme.of(context)
.textTheme
.bodyText1!
.merge(
const TextStyle(fontWeight: FontWeight.w900,)),
),
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [

],
)
],
)
],
),
);
}
}

class IconText extends StatelessWidget {
final IconData iconData;
final String title;

// ignore: use_key_in_widget_constructors
const IconText({required this.iconData, required this.title});

@override
Widget build(BuildContext context) {
return Row(
children: [
Icon(
iconData,
size: 17,
),
const SizedBox(width: 6),
Text(
title,
style: Theme.of(context).textTheme.bodyText1,
),
],
);
}
}
48 changes: 48 additions & 0 deletions Abhishek krishnan U V/lib/screens/home/widgets/profile_pic.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

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

@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const CircleAvatar(
radius: 22,
backgroundImage: AssetImage('assets/portfolioimage.jpeg'),
),
SizedBox(width: 85),
Text(
'NEWS app',
style: GoogleFonts.merriweather(
backgroundColor: Colors.white,
textStyle:
const TextStyle(fontSize: 25, color: Colors.black),
),
),
SizedBox(width: 10),
Text(
' by Abhishek',
style: GoogleFonts.merriweatherSans(
backgroundColor: Colors.white,
textStyle:
const TextStyle(fontSize: 17, color: Colors.redAccent),
),
),
],
),

],
),
],
);
}
}
Loading