repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/mysql/mysql.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_mysql.dart';
class Mysql extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'MySQL',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutMysql(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/mysql_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/views/chatrooms.dart
|
import '../helper/authenticate.dart';
import '../helper/constants.dart';
import '../helper/helperfunctions.dart';
import '../helper/theme.dart';
import '../services/auth.dart';
import 'package:flutter/material.dart';
import '../home/home_screen.dart';
import '../book.dart';
import '../profile.dart';
import '../updates.dart';
class ChatRoom extends StatefulWidget {
@override
_ChatRoomState createState() => _ChatRoomState();
}
class _ChatRoomState extends State<ChatRoom> {
int _selectedIndex = 0;
List<Widget> _widgetOptions = <Widget>[
Home(),
Book(),
Profile(),
Updates(),
];
void _onItemTap(int index) {
setState(() {
_selectedIndex = index;
});
}
Stream chatRooms;
Widget chatRoomsList() {
return StreamBuilder(
stream: chatRooms,
builder: (context, snapshot) {
return snapshot.hasData
? ListView.builder(
itemCount: snapshot.data.documents.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return ChatRoomsTile(
userName: snapshot.data.documents[index].data['chatRoomId']
.toString()
.replaceAll("_", "")
.replaceAll(Constants.myName, ""),
chatRoomId:
snapshot.data.documents[index].data["chatRoomId"],
);
})
: Container();
},
);
}
@override
void initState() {
// getUserInfogetChats();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Image.asset(
"assets/images/logo.png",
height: 40,
),
elevation: 0.0,
centerTitle: false,
actions: [
GestureDetector(
onTap: () {
AuthService().signOut();
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (context) => Authenticate()));
HelperFunctions.saveUserLoggedInSharedPreference(false);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Icon(Icons.exit_to_app)),
)
],
),
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(
Icons.home,
),
title: Text(
'Home',
),
),
BottomNavigationBarItem(
icon: Icon(
Icons.library_books,
),
title: Text(
'Books',
),
),
BottomNavigationBarItem(
icon: Icon(
Icons.code,
),
title: Text(
'Coding',
),
),
BottomNavigationBarItem(
icon: Icon(
Icons.notifications,
),
title: Text(
'Updates',
),
),
],
currentIndex: _selectedIndex,
onTap: _onItemTap,
selectedFontSize: 13.0,
unselectedFontSize: 13.0,
type: BottomNavigationBarType.fixed,
),
);
}
}
//floatingActionButton: FloatingActionButton(
// child: Icon(Icons.search),
//onPressed: () {
// Navigator.push(
// context, MaterialPageRoute(builder: (context) => Search()));
// },
// ),
class ChatRoomsTile extends StatelessWidget {
final String userName;
final String chatRoomId;
ChatRoomsTile({this.userName, @required this.chatRoomId});
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
color: Colors.black26,
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 20),
child: Row(
children: [
Container(
height: 30,
width: 30,
decoration: BoxDecoration(
color: CustomTheme.colorAccent,
borderRadius: BorderRadius.circular(30)),
child: Text(userName.substring(0, 1),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 16,
// fontFamily: 'OverpassRegular',
fontWeight: FontWeight.w300)),
),
SizedBox(
width: 12,
),
Text(userName,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.white,
fontSize: 16,
// fontFamily: 'OverpassRegular',
fontWeight: FontWeight.w300))
],
),
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/views/forgot_password.dart
|
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
// ignore: must_be_immutable
class ForgotPassword extends StatelessWidget {
TextEditingController editController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text("Forgot password"),
),
body: Container(
margin: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Container(
width:200.0,
height: 200.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new AssetImage('images/logo.png')
)
)),
SizedBox(
height: 50,
),
TextField(
controller: editController,
decoration: InputDecoration(
// focusColor: Colors.white,
// hoverColor: Colors.white,
labelText: "Email",
hintText: "Enter Email",
hintStyle: TextStyle(
color: Colors.white,
//fontStyle: FontStyle.italic,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white)),
),
),
SizedBox(
height: 10,
),
Container(
width: double.infinity,
child: RaisedButton(
color: Colors.blue,
onPressed: () {
resetPassword(context);
},
child: Text(
"Reset password",
style: TextStyle(color: Colors.white),
),
),
)
],
),
),
);
}
void resetPassword(BuildContext context) async {
if (editController.text.length == 0 || !editController.text.contains("@")) {
Fluttertoast.showToast(msg: "Enter valid email");
return;
}
await FirebaseAuth.instance
.sendPasswordResetEmail(email: editController.text);
Fluttertoast.showToast(
msg:
"Reset password link has sent your mail please use it to change the password.");
Navigator.pop(context);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/views/chat.dart
|
import 'dart:io';
import 'package:programmingworld/helper/constants.dart';
import 'package:programmingworld/services/database.dart';
import 'package:programmingworld/widget/widget.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
class Chat extends StatefulWidget {
final String chatRoomId;
Chat({this.chatRoomId});
@override
_ChatState createState() => _ChatState();
}
class _ChatState extends State<Chat> {
Stream<QuerySnapshot> chats;
TextEditingController messageEditingController = new TextEditingController();
Widget chatMessages() {
return StreamBuilder(
stream: chats,
builder: (context, snapshot) {
return snapshot.hasData
? ListView.builder(
itemCount: snapshot.data.documents.length,
itemBuilder: (context, index) {
return MessageTile(
message: snapshot.data.documents[index].data["message"],
sendByMe: Constants.myName ==
snapshot.data.documents[index].data["sendBy"],
);
})
: Container();
},
);
}
addMessage() {
if (messageEditingController.text.isNotEmpty) {
Map<String, dynamic> chatMessageMap = {
"sendBy": Constants.myName,
"message": messageEditingController.text,
'time': DateTime.now().millisecondsSinceEpoch,
};
DatabaseMethods().addMessage(widget.chatRoomId, chatMessageMap);
setState(() {
messageEditingController.text = "";
});
}
}
@override
void initState() {
DatabaseMethods().getChats(widget.chatRoomId).then((val) {
setState(() {
chats = val;
});
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBarMain(context),
body: Container(
child: Stack(
children: [
chatMessages(),
Container(
alignment: Alignment.bottomCenter,
width: MediaQuery.of(context).size.width,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 24),
color: Color(0x54FFFFFF),
child: Row(
children: [
Expanded(
child: TextField(
controller: messageEditingController,
style: simpleTextStyle(),
decoration: InputDecoration(
hintText: "Message ...",
hintStyle: TextStyle(
color: Colors.white,
fontSize: 16,
),
border: InputBorder.none),
)),
SizedBox(
width: 16,
),
GestureDetector(
onTap: () {
addMessage();
},
child: Container(
height: 40,
width: 40,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0x36FFFFFF),
const Color(0x0FFFFFFF)
],
begin: FractionalOffset.topLeft,
end: FractionalOffset.bottomRight),
borderRadius: BorderRadius.circular(40)),
padding: EdgeInsets.all(12),
child: Image.asset(
"assets/images/send.png",
height: 25,
width: 25,
)),
),
],
),
),
),
],
),
),
);
}
}
class MessageTile extends StatelessWidget {
final String message;
final bool sendByMe;
MessageTile({@required this.message, @required this.sendByMe});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
top: 8, bottom: 8, left: sendByMe ? 0 : 24, right: sendByMe ? 24 : 0),
alignment: sendByMe ? Alignment.centerRight : Alignment.centerLeft,
child: Container(
margin:
sendByMe ? EdgeInsets.only(left: 30) : EdgeInsets.only(right: 30),
padding: EdgeInsets.only(top: 17, bottom: 17, left: 20, right: 20),
decoration: BoxDecoration(
borderRadius: sendByMe
? BorderRadius.only(
topLeft: Radius.circular(23),
topRight: Radius.circular(23),
bottomLeft: Radius.circular(23))
: BorderRadius.only(
topLeft: Radius.circular(23),
topRight: Radius.circular(23),
bottomRight: Radius.circular(23)),
gradient: LinearGradient(
colors: sendByMe
? [const Color(0xff007EF4), const Color(0xff2A75BC)]
: [const Color(0x1AFFFFFF), const Color(0x1AFFFFFF)],
)),
child: Text(message,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'OverpassRegular',
fontWeight: FontWeight.w300)),
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/views/signin.dart
|
import '../helper/helperfunctions.dart';
import '../helper/theme.dart';
import '../services/auth.dart';
import '../services/database.dart';
import '../views/chatrooms.dart';
import '../views/forgot_password.dart';
import '../widget/widget.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import '../home/home_screen.dart';
import '../aftersplash.dart';
class SignIn extends StatefulWidget {
final Function toggleView;
SignIn(this.toggleView);
@override
_SignInState createState() => _SignInState();
}
class _SignInState extends State<SignIn> {
TextEditingController emailEditingController = new TextEditingController();
TextEditingController passwordEditingController = new TextEditingController();
AuthService authService = new AuthService();
final formKey = GlobalKey<FormState>();
bool isLoading = false;
signIn() async {
if (formKey.currentState.validate()) {
setState(() {
isLoading = true;
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => After()));
});
await authService
.signInWithEmailAndPassword(
emailEditingController.text, passwordEditingController.text)
.then((result) async {
if (result != null) {
QuerySnapshot userInfoSnapshot =
await DatabaseMethods().getUserInfo(emailEditingController.text);
HelperFunctions.saveUserLoggedInSharedPreference(true);
HelperFunctions.saveUserNameSharedPreference(
userInfoSnapshot.documents[0].data["userName"]);
HelperFunctions.saveUserEmailSharedPreference(
userInfoSnapshot.documents[0].data["userEmail"]);
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => ChatRoom()));
} else {
setState(() {
isLoading = false;
//show snackbar
});
}
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBarMain(context),
body: isLoading
? Container(
child: Center(child: CircularProgressIndicator()),
)
: Container(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
Spacer(),
Form(
key: formKey,
child: Column(
children: [
new Container(
width:200.0,
height: 200.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new AssetImage('images/logo.png')
)
)),
TextFormField(
validator: (val) {
return RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(val)
? null
: "Please Enter Correct Email";
},
controller: emailEditingController,
// style: simpleTextStyle(),
decoration: new InputDecoration(
hintText: "Enter your email",
labelText: "Email",
labelStyle: new TextStyle(
color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide:
new BorderSide(color: Colors.red)))),
TextFormField(
obscureText: true,
validator: (val) {
return val.length > 6
? null
: "Enter Password 6+ characters";
},
// style: simpleTextStyle(),
controller: passwordEditingController,
decoration: new InputDecoration(
hintText: "Enter the Password",
labelText: "Password",
labelStyle: new TextStyle(
color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide:
new BorderSide(color: Colors.red)))),
],
),
),
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ForgotPassword()));
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
child: Text(
"Forgot Password?",
// style: simpleTextStyle(),
)),
)
],
),
SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
signIn();
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: LinearGradient(
colors: [
const Color(0xff007EF4),
const Color(0xff2A75BC)
],
)),
width: MediaQuery.of(context).size.width,
child: Text(
"Sign In",
style: biggerTextStyle(),
textAlign: TextAlign.center,
),
),
),
SizedBox(
height: 16,
),
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Don't have account? ",
// style: simpleTextStyle(),
),
GestureDetector(
onTap: () {
widget.toggleView();
},
child: Text(
"Register now",
style: TextStyle(
color: Colors.black,
fontSize: 16,
decoration: TextDecoration.underline),
),
),
],
),
SizedBox(
height: 50,
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/views/signup.dart
|
import '../helper/helperfunctions.dart';
import '../helper/theme.dart';
import '../services/auth.dart';
import '../services/database.dart';
import '../views/chatrooms.dart';
import '../widget/widget.dart';
import 'package:flutter/material.dart';
class SignUp extends StatefulWidget {
final Function toggleView;
SignUp(this.toggleView);
@override
_SignUpState createState() => _SignUpState();
}
class _SignUpState extends State<SignUp> {
TextEditingController emailEditingController = new TextEditingController();
TextEditingController passwordEditingController = new TextEditingController();
TextEditingController usernameEditingController = new TextEditingController();
AuthService authService = new AuthService();
DatabaseMethods databaseMethods = new DatabaseMethods();
final formKey = GlobalKey<FormState>();
bool isLoading = false;
singUp() async {
if (formKey.currentState.validate()) {
setState(() {
isLoading = true;
});
await authService
.signUpWithEmailAndPassword(
emailEditingController.text, passwordEditingController.text)
.then((result) {
if (result != null) {
Map<String, String> userDataMap = {
"userName": usernameEditingController.text,
"userEmail": emailEditingController.text
};
databaseMethods.addUserInfo(userDataMap);
HelperFunctions.saveUserLoggedInSharedPreference(true);
HelperFunctions.saveUserNameSharedPreference(
usernameEditingController.text);
HelperFunctions.saveUserEmailSharedPreference(
emailEditingController.text);
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => ChatRoom()));
}
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBarMain(context),
body: isLoading
? Container(
child: Center(
child: CircularProgressIndicator(),
),
)
: Container(
padding: EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
Spacer(),
Form(
key: formKey,
child: Column(
children: [
new Container(
width:200.0,
height: 200.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new AssetImage('images/logo.png')
)
)),
TextFormField(
// style: simpleTextStyle(),
controller: usernameEditingController,
validator: (val) {
return val.isEmpty || val.length < 3
? "Enter Username 3+ characters"
: null;
},
decoration: new InputDecoration(
hintText: "Enter your Username",
labelText: "Username",
labelStyle: new TextStyle(
color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide:
new BorderSide(color: Colors.red)))),
TextFormField(
controller: emailEditingController,
// style: simpleTextStyle(),
validator: (val) {
return RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(val)
? null
: "Enter correct email";
},
decoration: new InputDecoration(
hintText: "Enter your Email",
labelText: "Email",
labelStyle: new TextStyle(
color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide:
new BorderSide(color: Colors.red)))),
TextFormField(
obscureText: true,
// style: simpleTextStyle(),
controller: passwordEditingController,
validator: (val) {
return val.length < 6
? "Enter Password 6+ characters"
: null;
},
decoration: new InputDecoration(
hintText: "Enter your Password",
labelText: "Password",
labelStyle: new TextStyle(
color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide:
new BorderSide(color: Colors.red))),
),
],
),
),
SizedBox(
height: 16,
),
GestureDetector(
onTap: () {
singUp();
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: LinearGradient(
colors: [
const Color(0xff007EF4),
const Color(0xff2A75BC)
],
)),
width: MediaQuery.of(context).size.width,
child: Text(
"Sign Up",
style: biggerTextStyle(),
textAlign: TextAlign.center,
),
),
),
SizedBox(
height: 16,
),
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Already have an account? ",
// style: simpleTextStyle(),
),
GestureDetector(
onTap: () {
widget.toggleView();
},
child: Text(
"SignIn Now",
style: TextStyle(
color: Colors.black,
fontSize: 16,
decoration: TextDecoration.underline),
),
),
],
),
SizedBox(
height: 50,
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/js/about_js.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutJS extends StatelessWidget {
final showData;
AboutJS(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/js/js.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_js.dart';
class Javascript extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Javascript',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AboutJS(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/js_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/c_plus_plus/about_c++.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutCplus extends StatelessWidget {
final showData;
AboutCplus(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/c_plus_plus/c++.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_c++.dart';
class Cplus extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'C++ Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutCplus(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/c_plusplusdata.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_react.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookReact extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookReactPage(),
);
}
}
class BookReactPage extends StatefulWidget {
@override
_BookReactPageState createState() => _BookReactPageState();
}
class _BookReactPageState extends State<BookReactPage> {
String url =
"https://norse-posts.000webhostapp.com/Books/30-days-of-react-ebook-fullstackio.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_mysql.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookMySQL extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookMySQLPage(),
);
}
}
class BookMySQLPage extends StatefulWidget {
@override
_BookMySQLPageState createState() => _BookMySQLPageState();
}
class _BookMySQLPageState extends State<BookMySQLPage> {
String url =
"https://norse-posts.000webhostapp.com/Books/Learning%20MySQL.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_php.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookPHP extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookPHPPage(),
);
}
}
class BookPHPPage extends StatefulWidget {
@override
_BookPHPPageState createState() => _BookPHPPageState();
}
class _BookPHPPageState extends State<BookPHPPage> {
String url = "https://norse-posts.000webhostapp.com/Books/PHP.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_c.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookC extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookCPage(),
);
}
}
class BookCPage extends StatefulWidget {
@override
_BookCPageState createState() => _BookCPageState();
}
class _BookCPageState extends State<BookCPage> {
String url =
"https://norse-posts.000webhostapp.com/Books/The%20C%20Programming%20Language.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_python.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookPython extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookPythonPage(),
);
}
}
class BookPythonPage extends StatefulWidget {
@override
_BookPythonPageState createState() => _BookPythonPageState();
}
class _BookPythonPageState extends State<BookPythonPage> {
String url = "https://norse-posts.000webhostapp.com/Books/pythonlearn.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_flutter.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookFlutter extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookFlutterPage(),
);
}
}
class BookFlutterPage extends StatefulWidget {
@override
_BookFlutterPageState createState() => _BookFlutterPageState();
}
class _BookFlutterPageState extends State<BookFlutterPage> {
String url =
"https://norse-posts.000webhostapp.com/Books/flutter_tutorial.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_cplusplus.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookCplusplus extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookCplusplusPage(),
);
}
}
class BookCplusplusPage extends StatefulWidget {
@override
_BookCplusplusPageState createState() => _BookCplusplusPageState();
}
class _BookCplusplusPageState extends State<BookCplusplusPage> {
String url = "https://norse-posts.000webhostapp.com/Books/tutorial.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_js.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookJS extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookJSPage(),
);
}
}
class BookJSPage extends StatefulWidget {
@override
_BookJSPageState createState() => _BookJSPageState();
}
class _BookJSPageState extends State<BookJSPage> {
String url =
"https://norse-posts.000webhostapp.com/Books/Eloquent_JavaScript.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/book/book_java.dart
|
import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class BookJava extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// title: 'Flutter PDF',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: BookJavaPage(),
);
}
}
class BookJavaPage extends StatefulWidget {
@override
_BookJavaPageState createState() => _BookJavaPageState();
}
class _BookJavaPageState extends State<BookJavaPage> {
String url = "https://norse-posts.000webhostapp.com/Books/javanotes5.pdf";
String pdfasset = "assets/sample.pdf";
PDFDocument _doc;
bool _loading;
@override
void initState() {
super.initState();
_initPdf();
}
_initPdf() async {
setState(() {
_loading = true;
});
final doc = await PDFDocument.fromURL(url);
setState(() {
_doc = doc;
_loading = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _loading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(
document: _doc,
indicatorBackground: Colors.red,
// showIndicator: false,
// showPicker: false,
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/page/detail_view.dart
|
import 'dart:ui';
import 'package:clippy_flutter/clippy_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../constant/constant.dart';
import '../models/champion.dart';
class DetailView extends StatefulWidget {
final Champion champion;
const DetailView({this.champion});
@override
_DetailViewState createState() => _DetailViewState(champion: champion);
}
class _DetailViewState extends State<DetailView> with TickerProviderStateMixin {
final Champion champion;
_DetailViewState({this.champion});
bool init = false;
Animation<double> animation;
AnimationController controller;
@override
void initState() {
super.initState();
controller = AnimationController(
vsync: this,
duration: Duration(seconds: 1),
);
Tween<double> tween = Tween(begin: 0.0, end: 400.0);
animation = tween
.animate(CurvedAnimation(parent: controller, curve: Curves.easeInExpo))
..addListener(() {
setState(() {});
});
controller.forward();
Future.delayed(const Duration(milliseconds: 500), () {
setState(() {
init = true;
});
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgoundColor,
body: Stack(children: [
Hero(
tag: champion.name.toUpperCase(),
child: ShaderMask(
shaderCallback: (rect) {
return LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [backgoundColor, Colors.transparent],
).createShader(Rect.fromLTRB(0, 0, rect.width, rect.height));
},
blendMode: BlendMode.dstIn,
child: Image.asset(
"images/matrix.jpg",
fit: BoxFit.fitWidth,
width: double.infinity,
),
),
),
Padding(
padding: EdgeInsets.only(left: 5, top: 45),
child: CustomBackButton()),
Align(
alignment: Alignment.bottomCenter,
child: Stack(
children: [
Container(
padding: EdgeInsets.only(left: 15, right: 15, bottom: 20),
width: double.infinity,
height: 320,
child: Stack(
children: [
AnimatedBorder(animation: animation),
Align(
alignment: Alignment.center,
child: AnimatedOpacity(
opacity: init ? 1 : 0,
duration: Duration(milliseconds: 500),
child: Padding(
padding: const EdgeInsets.only(top: 50.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset("images/matrix.jpg",
width: 40, height: 40),
SizedBox(
height: 20,
),
Text("ROLE",
style: textTheme.headline3),
Text(
champion.role
.toString()
.split(".")[1],
style: textTheme.headline3
.copyWith(
color:
Color(0xffAE914B)))
]),
Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Container(
height: 40,
child: Center(
child: DifficultyGraph(
count: widget.champion
.difficulty.index),
),
),
SizedBox(
height: 20,
),
Text(
"DIFFICULTY",
style: textTheme.headline3,
),
Text(
champion.difficulty
.toString()
.split(".")[1]
.toUpperCase(),
style: textTheme.headline3
.copyWith(
color: Color(0xffAE914B)))
],
)
],
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 30.0),
child: Divider(
color: Colors.white,
height: 1,
),
),
Padding(
padding: const EdgeInsets.only(
left: 20, right: 20, bottom: 30),
child: Text(champion.description,
style: textTheme.bodyText1,
maxLines: 6,
overflow: TextOverflow.ellipsis),
)
]),
),
),
)
],
)),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: AnimatedOpacity(
duration: Duration(milliseconds: 500),
opacity: init ? 1.0 : 0.0,
child: Container(
margin: EdgeInsets.only(bottom: 185),
width: double.infinity,
height: 270,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
champion.nickName,
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: 10,
),
Text(
champion.name.toUpperCase(),
style: Theme.of(context).textTheme.headline1.copyWith(
letterSpacing:
4 + 25 * ((400 - animation.value) / 400.0)),
),
]),
),
),
),
]),
);
}
}
class DifficultyGraph extends StatelessWidget {
final count;
const DifficultyGraph({this.count});
@override
Widget build(BuildContext context) {
return Stack(children: [
Parallelogram(
cutLength: 10.0,
edge: Edge.RIGHT,
child: Container(
color: difficultyEnableColor,
width: 25.0,
height: 10.0,
),
),
Padding(
padding: EdgeInsets.only(left: 16),
child: Parallelogram(
cutLength: 10.0,
edge: Edge.RIGHT,
child: Container(
color: count > 0 ? difficultyEnableColor : difficultyDisableColor,
width: 25.0,
height: 10.0,
),
),
),
Padding(
padding: EdgeInsets.only(left: 32),
child: Parallelogram(
cutLength: 10.0,
edge: Edge.RIGHT,
child: Container(
color: count > 1 ? difficultyEnableColor : difficultyDisableColor,
width: 25.0,
height: 10.0,
),
),
),
]);
}
}
class AnimatedBorder extends StatelessWidget {
const AnimatedBorder({
@required this.animation,
});
final Animation<double> animation;
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
return AnimatedBuilder(
animation: animation,
builder: (context, snapshot) {
return CustomPaint(
painter: MyPainter(value: animation.value),
child: Container(
width: constraints.maxWidth,
height: constraints.maxHeight,
),
);
},
);
});
}
}
class CustomBackButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClipOval(
child: Container(
color: Colors.grey[100].withOpacity(0.3),
child: InkWell(
child: SizedBox(
width: 40,
height: 40,
child: Icon(
Icons.arrow_back_ios,
color: Colors.white,
)),
onTap: () {
Navigator.pop(context);
},
),
),
);
}
}
class MyPainter extends CustomPainter {
final double value;
MyPainter({this.value});
final paintBorder = Paint()
..color = Colors.white30
..style = PaintingStyle.stroke
..strokeWidth = 1.0;
final transparentBorder = Paint()
..color = Colors.transparent
..style = PaintingStyle.stroke
..strokeWidth = 1.0;
@override
void paint(Canvas canvas, Size size) {
var path = Path();
if (value < 15) {
double lineValue = size.width * value / 100;
path.lineTo(lineValue, 0);
canvas.drawPath(path, paintBorder);
return;
} else {
path.lineTo(size.width * 15 / 100, 0);
canvas.drawPath(path, paintBorder);
}
path = Path();
path.moveTo(size.width * 15 / 100, 0);
if (value >= 15 && value <= 85) {
double lineValue = size.width * value / 100;
path.lineTo(lineValue, 0);
canvas.drawPath(path, transparentBorder);
return;
} else {
path.lineTo(size.width * 85 / 100, 0);
canvas.drawPath(path, transparentBorder);
}
path = Path();
path.moveTo(size.width * 85 / 100, 0);
if (value > 85 && value < 100) {
double lineValue = size.width * value / 100;
path.lineTo(lineValue, 0);
canvas.drawPath(path, paintBorder);
return;
} else {
path.lineTo(size.width, 0);
canvas.drawPath(path, paintBorder);
}
if (value < 200) {
double lineValue = size.height * (value - 100) / 100;
path.lineTo(size.width, lineValue);
canvas.drawPath(path, paintBorder);
return;
} else {
path.lineTo(size.width, size.height);
canvas.drawPath(path, paintBorder);
}
path = Path();
path.moveTo(size.width, size.height);
if (value < 300) {
double lineValue = size.width - size.width * (value - 200) / 100;
path.lineTo(lineValue, size.height);
canvas.drawPath(path, paintBorder);
return;
} else {
path.lineTo(0, size.height);
canvas.drawPath(path, paintBorder);
}
path = Path();
path.moveTo(0, size.height);
if (value < 400) {
double lineValue = size.height - size.height * (value - 300) / 100;
path.lineTo(0, lineValue);
canvas.drawPath(path, paintBorder);
return;
} else {
path.lineTo(0, 0);
canvas.drawPath(path, paintBorder);
}
}
@override
bool shouldRepaint(CustomPainter old) {
return false;
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/models/champion.dart
|
import '../constant/constant.dart';
class Champion {
final String name;
final String nickName;
final Role role;
final Difficulty difficulty;
final String description;
const Champion(
{this.name, this.nickName, this.difficulty, this.role, this.description});
}
final championsMap = {
"java": Champion(
name: "Java",
role: Role.ASSASIN,
difficulty: Difficulty.MODERATE,
nickName: "PROGRAMMING",
description:
"Abandoning the Kinkou Order and her title of the Fist of Shadow, Akali now strikes alone, ready to be the deadly weapon her people need. Though she holds onto all she learned from her master Shen, she has pledged to defend Ionia from its enemies, one kill at a time. Akali may strike in silence, but her message will be heard loud and clear: fear the assassin with no master."),
"flutter": Champion(
name: "Camile",
role: Role.FIGHTER,
difficulty: Difficulty.MODERATE,
nickName: "THE STEEL SHADOW",
description:
"Weaponized to operate outside the boundaries of the law, Camille is the Principal Intelligencer of Clan Ferros—an elegant and elite agent who ensures the Piltover machine and its Zaunite underbelly runs smoothly. Adaptable and precise, she views sloppy technique as an embarrassment that must be put to order. With a mind as sharp as the blades she bears, Camille's pursuit of superiority through hextech body augmentation has left many to wonder if she is now more machine than woman."),
"php": Champion(
name: "Ezreal",
role: Role.MARKSMAN,
difficulty: Difficulty.MODERATE,
nickName: "THE PRODIGAL EXPLORER",
description:
"A dashing adventurer, unknowingly gifted in the magical arts, Ezreal raids long-lost catacombs, tangles with ancient curses, and overcomes seemingly impossible odds with ease. His courage and bravado knowing no bounds, he prefers to improvise his way out of any situation, relying partially on his wits, but mostly on his mystical Shuriman gauntlet, which he uses to unleash devastating arcane blasts. One thing is for sure—whenever Ezreal is around, trouble isn't too far behind. Or ahead. Probably everywhere."),
"react": Champion(
name: "Zoe",
role: Role.MAGE,
difficulty: Difficulty.HIGH,
nickName: "THE ASPECT OF TWILIGHT",
description:
"As the embodiment of mischief, imagination, and change, Zoe acts as the cosmic messenger of Targon, heralding major events that reshape worlds. Her mere presence warps the arcane mathematics governing realities, sometimes causing cataclysms without conscious effort or malice. This perhaps explains the breezy nonchalance with which Zoe approaches her duties, giving her plenty of time to focus on playing games, tricking mortals, or otherwise amusing herself. An encounter with Zoe can be joyous and life affirming, but it is always more than it appears and often extremely dangerous."),
"js": Champion(
name: "Irelia",
role: Role.FIGHTER,
difficulty: Difficulty.MODERATE,
nickName: "THE BLADE DANCER",
description:
"The Noxian occupation of Ionia produced many heroes, none more unlikely than young Irelia of Navori. Trained in the ancient dances of her province, she adapted her art for war, using the graceful and carefully practised movements to levitate a host of deadly blades. After proving herself as a fighter, she was thrust into the role of resistance leader and figurehead, and to this day remains dedicated to the preservation of her homeland."),
"oops": Champion(
name: "Poppy",
role: Role.TANKER,
difficulty: Difficulty.MODERATE,
nickName: "KEEPER OF THE HAMMER",
description:
"Runeterra has no shortage of valiant champions, but few are as tenacious as Poppy. Bearing the legendary hammer of Orlon, a weapon twice her size, this determined yordle has spent untold years searching in secret for the fabled “Hero of Demacia,” said to be its rightful wielder. Until then, she dutifully charges into battle, pushing back the kingdom's enemies with every whirling strike."),
};
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/models/user.dart
|
class User {
final String uid;
User({this.uid});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/python/about_python.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutPython extends StatelessWidget {
final showData;
AboutPython(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/python/python.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_python.dart';
class Python extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Python Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutPython(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/python_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/c/about_c.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutC extends StatelessWidget {
final showData;
AboutC(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/c/c.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_c.dart';
class Cdata extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'C Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AboutC(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future:
DefaultAssetBundle.of(context).loadString("assets/c_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/widget/widget.dart
|
import 'package:flutter/material.dart';
Widget appBarMain(BuildContext context) {
return AppBar(
title: Image.asset(
"assets/images/logo.png",
height: 40,
),
elevation: 0.0,
centerTitle: false,
);
}
InputDecoration textFieldInputDecoration(String hintText) {
return InputDecoration(
hintText: hintText,
hintStyle: TextStyle(color: Colors.white54),
focusedBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)),
enabledBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)));
}
TextStyle simpleTextStyle() {
return TextStyle(color: Colors.white, fontSize: 16);
}
TextStyle biggerTextStyle() {
return TextStyle(color: Colors.white, fontSize: 17);
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/constant/constant.dart
|
import 'dart:ui';
import 'package:flutter/material.dart';
enum Role { TANKER, FIGHTER, MARKSMAN, MAGE, ASSASIN }
enum Difficulty { LOW, MODERATE, HIGH }
final backgoundColor = Color(0xff000913);
final appbarColor = Color(0xff112120);
final difficultyEnableColor = Color(0xff08d6f6);
final difficultyDisableColor = Color(0xff023240);
const textTheme = TextTheme(
headline1: TextStyle(
fontSize: 60.0,
fontWeight: FontWeight.bold,
color: Colors.white,
fontStyle: FontStyle.italic,
letterSpacing: 4.0),
headline2: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.normal,
color: Colors.white,
letterSpacing: 1.0),
headline3: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.normal,
color: Colors.white,
letterSpacing: 1.0),
bodyText1: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.normal,
color: Colors.white,
letterSpacing: 1.0),
);
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/home/home_screen.dart
|
import '../java/java.dart';
import 'package:flutter/material.dart';
import '../php/php.dart';
import '../react/react.dart';
import '../flutter/flutter.dart';
import 'package:vertical_card_pager/vertical_card_pager.dart';
import '../constant/constant.dart';
import '../js/js.dart';
import '../c/c.dart';
import '../c_plus_plus/c++.dart';
import '../python/python.dart';
import '../mysql/mysql.dart';
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Programming World',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'lol',
textTheme: textTheme,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
final List<String> titles = [
"JAVA", //0
"FLUTTER", //1
"PHP", //2
"REACT", //3
"JS", //4
"C", //5
"C++", //6
"PYTHON", //7
"MySQL", //8
];
final List<Widget> images = [
Hero(
tag: "JAVA",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/xxx.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "FLUTTER",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/flutter1.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "PHP",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/matr.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "REACT",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/react.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "JS",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/jss.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "C",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/c.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "C++",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/c-1.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "PYTHON",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/python.gif",
fit: BoxFit.cover,
),
),
),
Hero(
tag: "MySQL",
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.network(
"https://pw.findjobalerts.com/wp-content/uploads/2020/09/mysql.gif",
fit: BoxFit.cover,
),
),
),
];
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: <Widget>[
/* Container(
width: double.infinity,
height: 70,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15.0),
child: Center(
child: Image.network(
"images/logo.png",
fit: BoxFit.cover,
)),
),
),*/
Expanded(
child: Container(
child: VerticalCardPager(
// textStyle: TextStyle(color : Colors.red),
titles: titles,
images: images,
onPageChanged: (page) {
// print(page);
},
onSelectedItem: (index) {
if (index == 0) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Java()),
);
}
if (index == 1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => new Flutterdata()),
);
}
if (index == 2) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new PHP()),
);
}
if (index == 3) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new React()),
);
}
if (index == 4) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => new Javascript()),
);
}
if (index == 5) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Cdata()),
);
}
if (index == 6) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Cplus()),
);
}
if (index == 7) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Python()),
);
}
if (index == 8) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => new Mysql()),
);
}
},
),
),
),
],
),
),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/helper/authenticate.dart
|
import '../views/signin.dart';
import '../views/signup.dart';
import 'package:flutter/material.dart';
class Authenticate extends StatefulWidget {
@override
_AuthenticateState createState() => _AuthenticateState();
}
class _AuthenticateState extends State<Authenticate> {
bool showSignIn = true;
void toggleView() {
setState(() {
showSignIn = !showSignIn;
});
}
@override
Widget build(BuildContext context) {
if (showSignIn) {
return SignIn(toggleView);
} else {
return SignUp(toggleView);
}
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/helper/helperfunctions.dart
|
import 'package:shared_preferences/shared_preferences.dart';
class HelperFunctions {
static String sharedPreferenceUserLoggedInKey = "ISLOGGEDIN";
static String sharedPreferenceUserNameKey = "USERNAMEKEY";
static String sharedPreferenceUserEmailKey = "USEREMAILKEY";
/// saving data to sharedpreference
static Future<bool> saveUserLoggedInSharedPreference(
bool isUserLoggedIn) async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.setBool(
sharedPreferenceUserLoggedInKey, isUserLoggedIn);
}
static Future<bool> saveUserNameSharedPreference(String userName) async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.setString(sharedPreferenceUserNameKey, userName);
}
static Future<bool> saveUserEmailSharedPreference(String userEmail) async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.setString(sharedPreferenceUserEmailKey, userEmail);
}
/// fetching data from sharedpreference
static Future<bool> getUserLoggedInSharedPreference() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.getBool(sharedPreferenceUserLoggedInKey);
}
static Future<String> getUserNameSharedPreference() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.getString(sharedPreferenceUserNameKey);
}
static Future<String> getUserEmailSharedPreference() async {
SharedPreferences preferences = await SharedPreferences.getInstance();
return await preferences.getString(sharedPreferenceUserEmailKey);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/helper/constants.dart
|
class Constants{
static String myName = "";
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/helper/theme.dart
|
import 'package:flutter/material.dart';
class CustomTheme {
static Color colorAccent = Color(0xff007EF4);
static Color textColor = Color(0xff071930);
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/react/about_react.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutReact extends StatelessWidget {
final showData;
AboutReact(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/react/react.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_react.dart';
class React extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'React Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutReact(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/react_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/php/about_php.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutPHP extends StatelessWidget {
final showData;
AboutPHP(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/php/php.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_php.dart';
class PHP extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'PHP Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AboutPHP(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/php_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/services/auth.dart
|
import '../models/user.dart';
import '../views/chat.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '../services/auth.dart';
import '../views/chatrooms.dart';
import '../widget/widget.dart';
class AuthService {
final FirebaseAuth _auth = FirebaseAuth.instance;
User _userFromFirebaseUser(FirebaseUser user) {
return user != null ? User(uid: user.uid) : null;
}
Future signInWithEmailAndPassword(String email, String password) async {
try {
AuthResult result = await _auth.signInWithEmailAndPassword(
email: email, password: password);
FirebaseUser user = result.user;
return _userFromFirebaseUser(user);
} catch (e) {
print(e.toString());
return null;
}
}
Future signUpWithEmailAndPassword(String email, String password) async {
try {
AuthResult result = await _auth.createUserWithEmailAndPassword(
email: email, password: password);
FirebaseUser user = result.user;
return _userFromFirebaseUser(user);
} catch (e) {
print(e.toString());
return null;
}
}
Future resetPass(String email) async {
try {
return await _auth.sendPasswordResetEmail(email: email);
} catch (e) {
print(e.toString());
return null;
}
}
Future<FirebaseUser> signInWithGoogle(BuildContext context) async {
final GoogleSignIn _googleSignIn = new GoogleSignIn();
final GoogleSignInAccount googleSignInAccount =
await _googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleSignInAuthentication.idToken,
accessToken: googleSignInAuthentication.accessToken);
AuthResult result = await _auth.signInWithCredential(credential);
FirebaseUser userDetails = result.user;
if (result == null) {
} else {
Navigator.push(context, MaterialPageRoute(builder: (context) => Chat()));
}
}
Future signOut() async {
try {
return await _auth.signOut();
} catch (e) {
print(e.toString());
return null;
}
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/services/database.dart
|
import 'package:cloud_firestore/cloud_firestore.dart';
class DatabaseMethods {
Future<void> addUserInfo(userData) async {
Firestore.instance.collection("users").add(userData).catchError((e) {
print(e.toString());
});
}
getUserInfo(String email) async {
return Firestore.instance
.collection("users")
.where("userEmail", isEqualTo: email)
.getDocuments()
.catchError((e) {
print(e.toString());
});
}
searchByName(String searchField) {
return Firestore.instance
.collection("users")
.where('userName', isEqualTo: searchField)
.getDocuments();
}
Future<bool> addChatRoom(chatRoom, chatRoomId) {
Firestore.instance
.collection("chatRoom")
.document(chatRoomId)
.setData(chatRoom)
.catchError((e) {
print(e);
});
}
getChats(String chatRoomId) async{
return Firestore.instance
.collection("chatRoom")
.document(chatRoomId)
.collection("chats")
.orderBy('time')
.snapshots();
}
Future<void> addMessage(String chatRoomId, chatMessageData){
Firestore.instance.collection("chatRoom")
.document(chatRoomId)
.collection("chats")
.add(chatMessageData).catchError((e){
print(e.toString());
});
}
getUserChats(String itIsMyName) async {
return await Firestore.instance
.collection("chatRoom")
.where('users', arrayContains: itIsMyName)
.snapshots();
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/flutter/about_flutter.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class AboutFlutter extends StatelessWidget {
final showData;
AboutFlutter(this.showData);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
Navigator.pop(context, true);
},
),
),
body: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 50, vertical: 10),
child: Container(
// margin: EdgeInsets.only(bottom: 01),
child: ListView(
//semanticContainer: true,
// child: Padding(
// padding: const EdgeInsets.all(30.0),
// child: new Column(
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 100,
),
Center(
child: Align(
alignment: Alignment.topCenter,
child: Text(
showData['name'],
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
),
),
SizedBox(
height: 20,
),
Center(
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
showData['bio'],
style: TextStyle(
color: Colors.grey,
),
),
),
),
],
),
),
// elevation: 5,
),
// ),
// ),
Container(
width: 100,
height: 100,
decoration:
ShapeDecoration(shape: CircleBorder(), color: Colors.white),
child: Padding(
padding: EdgeInsets.all(8),
child: DecoratedBox(
decoration: ShapeDecoration(
shape: CircleBorder(),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
showData['picture'],
))),
),
),
),
],
)),
);
}
}
| 0
|
mirrored_repositories/programming-world-flutter/lib
|
mirrored_repositories/programming-world-flutter/lib/flutter/flutter.dart
|
import 'package:flutter/material.dart';
import 'dart:convert';
import 'about_flutter.dart';
class Flutterdata extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ListViews',
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.grey,
iconSize: 35,
onPressed: () {
// Navigator.push(
Navigator.pop(context, true);
// context,
// MaterialPageRoute(builder: (context) => Nav()),
// );
}),
backgroundColor: Colors.white,
bottom: PreferredSize(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Flutter Programming',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30,
),
),
IconButton(
icon: const Icon(Icons.code),
iconSize: 35,
color: Colors.grey,
onPressed: () {},
),
],
),
),
preferredSize: Size(0.0, 80.0),
),
),
body: Center(
child: FutureBuilder(
builder: (context, snapshot) {
var showData = json.decode(snapshot.data);
return ListView.builder(
itemCount: showData.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 2.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
margin: new EdgeInsets.symmetric(
horizontal: 25.0, vertical: 15.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AboutFlutter(showData[index])),
);
},
child: ListTile(
contentPadding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 10.0),
leading: CircleAvatar(
backgroundImage:
NetworkImage(showData[index]['picture']),
),
title: Text(showData[index]['name']),
trailing: Icon(Icons.arrow_forward_ios),
),
),
);
},
);
},
future: DefaultAssetBundle.of(context)
.loadString("assets/flutter_data.json"),
),
),
),
);
}
}
class User {
String picture;
String name;
String bio;
User({this.picture, this.name, this.bio});
factory User.fromJson(Map<String, dynamic> json) {
return new User(
picture: json['picture'] as String,
name: json['name'] as String,
bio: json['bio'] as String,
);
}
}
class UserList {
List<User> users;
UserList({this.users});
}
| 0
|
mirrored_repositories/programming-world-flutter
|
mirrored_repositories/programming-world-flutter/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:programmingworld/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/I-Am-Rich-Flutter
|
mirrored_repositories/I-Am-Rich-Flutter/lib/main.dart
|
import 'package:flutter/material.dart';
// The code starts here in main
void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Center(
child: Text('I Am Rich'),
),
backgroundColor: Colors.blueGrey[900],
),
body: Center(
child: Image(
image: AssetImage('Images/diamond.png'),
),
),
backgroundColor: Colors.grey[900],
),
),
);
}
| 0
|
mirrored_repositories/I-Am-Rich-Flutter
|
mirrored_repositories/I-Am-Rich-Flutter/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:i_am_rich/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter
|
mirrored_repositories/Twitch-Clone-Flutter/lib/main.dart
|
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/controller/categories.dart';
import 'package:twitch_clone/controller/channel.dart';
import 'package:twitch_clone/controller/clips.dart';
import 'package:twitch_clone/controller/live.dart';
import 'package:twitch_clone/ui/browse/browse.dart';
import 'package:twitch_clone/ui/discover/discover.dart';
import 'package:twitch_clone/ui/following/following.dart';
import 'package:twitch_clone/utils/constants.dart';
import 'package:twitch_clone/utils/custom_icons.dart';
void main() => runApp(TwitchClone());
class TwitchClone extends StatefulWidget {
@override
_TwitchCloneState createState() => _TwitchCloneState();
}
class _TwitchCloneState extends State<TwitchClone> {
int _selectedIndex = 0;
static const following = 0;
static const discover = 1;
static const browse = 2;
Widget child;
final List<Widget> _children = [
Following(),
Discover(),
Browse()
];
@override
void initState() {
super.initState();
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor:
Constants.isDark ? Constants.darkPrimary : Constants.lightPrimary,
statusBarBrightness: Constants.isDark ? Brightness.dark : Brightness.light));
_onTabTapped(_selectedIndex);
}
Widget _actionButtons(IconData icon, Function function) {
return IconButton(
icon: Icon(icon),
onPressed: function,
);
}
Widget _profilePicture() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: 19.0,
height: 19.0,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(45.0)),
child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: Constants.profilePicture,
fit: BoxFit.cover,
),
),
),
);
}
void _onTabTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider<LiveController>.value(
value: LiveController(),
),
ChangeNotifierProvider<ChannelController>.value(
value: ChannelController(),
),
ChangeNotifierProvider<CategoriesController>.value(
value: CategoriesController(),
),
ChangeNotifierProvider<ClipsController>.value(
value: ClipsController(),
)
],
child: MaterialApp(
title: Constants.appName,
debugShowCheckedModeBanner: false,
theme: Constants.isDark ? Constants.darkTheme : Constants.lightTheme,
home: Scaffold(
appBar: AppBar(
elevation: 0.0,
leading: _profilePicture(),
actions: <Widget>[
_actionButtons(CustomIcons.cast, () {}),
_actionButtons(CustomIcons.notifications_none, () {}),
_actionButtons(CustomIcons.comment, () {}),
_actionButtons(CustomIcons.search, () {})
],
),
bottomNavigationBar: BottomNavigationBar(
selectedItemColor: Constants.twitchMainColor,
backgroundColor:
Constants.isDark ? Constants.darkPrimary : Constants.lightPrimary,
currentIndex: _selectedIndex,
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.favorite),
title: Text(
'Following',
style: TextStyle(fontFamily: 'Biotif Book'),
),
),
BottomNavigationBarItem(
icon: Icon(Icons.explore),
title: Text(
'Discover',
style: TextStyle(
fontFamily: 'Biotif Book',
),
),
),
BottomNavigationBarItem(
icon: Icon(Icons.filter_none),
title: Text(
'Browse',
style: TextStyle(
fontFamily: 'Biotif Book',
),
),
)
],
onTap: _onTabTapped
),
body: _children[_selectedIndex],
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/text_tag.dart
|
import 'package:flutter/material.dart';
import 'package:twitch_clone/utils/constants.dart';
class TextTag extends StatefulWidget {
final String text;
TextTag({Key key, this.text}) : super(key: key);
@override
_TextTagState createState() => _TextTagState();
}
class _TextTagState extends State<TextTag> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(right: 5.0),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15.0)),
child: Container(
color: Constants.isDark ? Colors.grey[800] : Colors.grey[300],
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Text(widget.text,
style: TextStyle(fontSize: 12.0, fontFamily: 'Biotif Book')),
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/categories_tile_small.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/categories.dart';
class CategoriesTileSmall extends StatefulWidget {
final CategoriesModel model;
CategoriesTileSmall({Key key, @required this.model}) : super(key: key);
@override
_CategoriesTileSmallState createState() => _CategoriesTileSmallState();
}
class _CategoriesTileSmallState extends State<CategoriesTileSmall> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K Viewers';
}
Widget _imageCover() {
return Padding(
padding: const EdgeInsets.only(right: 15.0),
child: Container(
width: 50.0,
height: 80.0,
child: FadeInImage.memoryNetwork(
image: widget.model.image,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
);
}
Widget _infoCategorie() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_title(), _views(), _tags()],
);
}
Widget _title() {
return Padding(
padding: const EdgeInsetsDirectional.only(top: 5.0),
child: Text(
widget.model.name,
style: TextStyle(fontFamily: 'Eina'),
overflow: TextOverflow.fade,
),
);
}
Widget _views() {
return Text(_showViews(),
style: TextStyle(
fontFamily: 'Shapiro', fontSize: 14.0, color: Colors.grey[700]));
}
Widget _tags() {
return Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 20.0, top: 5.0, bottom: 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_imageCover(), _infoCategorie()],
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/live_tile_large.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/live.dart';
class LiveTileLarge extends StatefulWidget {
final LiveModel model;
LiveTileLarge({Key key, @required this.model}) : super(key: key);
@override
_LiveTileLargeState createState() => _LiveTileLargeState();
}
class _LiveTileLargeState extends State<LiveTileLarge> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K Viewers';
}
Widget _headerLive() {
return Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[_imageLive(), _badgeLive(), _badgeViewers()],
);
}
Widget _bottomLive() {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_userImageLive(), _infoLive()
],
);
}
Widget _imageLive() {
return Container(
height: MediaQuery.of(context).size.height / 4,
width: MediaQuery.of(context).size.width,
child: FadeInImage.memoryNetwork(
image: widget.model.cover,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
);
}
Widget _badgeLive() {
return Positioned(
top: 6.0,
left: 6.0,
child: Card(
color: Colors.red,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4.0)),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 1.0, horizontal: 4.0),
child: Center(
child: Text(
'LIVE',
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
);
}
Widget _badgeViewers() {
return Positioned(
bottom: 6.0,
left: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [
0.7,
0.7
],
colors: [
Color.fromARGB(100, 0, 0, 0),
Color.fromARGB(100, 0, 0, 0)
])),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
child: Center(
child: Text(
_showViews(),
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
),
);
}
Widget _userImageLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Container(
width: 50.0,
height: 50.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(50.0),
child: FadeInImage.memoryNetwork(
image: widget.model.userPicture,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
);
}
Widget _tagsLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
Widget _infoLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.model.user, style: TextStyle(fontFamily: 'Eina')),
Text(widget.model.description,
style: TextStyle(fontSize: 13.0, fontFamily: 'Biotif Book')),
Text(widget.model.game,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[700],
fontFamily: 'Shapiro')),
_tagsLive()
],
),
);
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.only(top: 5.0, bottom: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_headerLive(), _bottomLive()],
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/live_tile_medium.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/live.dart';
class LiveTileMedium extends StatefulWidget {
final LiveModel model;
LiveTileMedium(
{Key key,
@required this.model})
: super(key: key);
@override
_LiveTileMediumState createState() => _LiveTileMediumState();
}
class _LiveTileMediumState extends State<LiveTileMedium> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K Viewers';
}
Widget _badgeViewers() {
return Positioned(
bottom: 6.0,
left: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [
0.7,
0.7
],
colors: [
Color.fromARGB(100, 0, 0, 0),
Color.fromARGB(100, 0, 0, 0)
])),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
child: Center(
child: Text(
_showViews(),
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
),
);
}
Widget _badgeLive() {
return Positioned(
top: 6.0,
left: 6.0,
child: Card(
color: Colors.red,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4.0)),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 1.0, horizontal: 4.0),
child: Center(
child: Text(
'LIVE',
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
);
}
Widget _imageCover() {
return Container(
height: MediaQuery.of(context).size.height / 4,
width: MediaQuery.of(context).size.width,
child: FadeInImage.memoryNetwork(
image: widget.model.cover,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
);
}
Widget _headerLive() {
return Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[_imageCover(), _badgeLive(), _badgeViewers()],
);
}
Widget _userImageLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Container(
width: 40.0,
height: 40.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(50.0),
child: FadeInImage.memoryNetwork(
image: widget.model.userPicture,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
);
}
Widget _tagsLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
Widget _infoLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.model.user, style: TextStyle(fontFamily: 'Eina')),
Text(widget.model.description,
style: TextStyle(fontSize: 13.0, fontFamily: 'Biotif Book')),
Text(widget.model.game,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[700],
fontFamily: 'Shapiro')),
_tagsLive()
],
),
);
}
Widget _bottomLive() {
return Row(
children: <Widget>[_userImageLive(), _infoLive()],
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Container(
width: 370.0,
child: InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.only(right: 18.0, left: 8.0),
child: Column(
children: <Widget>[_headerLive(), _bottomLive()],
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/video_tile_medium.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/live.dart';
class VideoTileMedium extends StatefulWidget {
final LiveModel model;
VideoTileMedium({Key key, @required this.model}) : super(key: key);
@override
_VideoTileMediumState createState() => _VideoTileMediumState();
}
class _VideoTileMediumState extends State<VideoTileMedium> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K Views';
}
String _showDate() {
DateTime date = DateTime.parse(widget.model.date);
Duration duration = DateTime.now().difference(date);
return '${duration.inDays} days ago';
}
Widget _badgeDuration() {
return Positioned(
top: 6.0,
left: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [
0.7,
0.7
],
colors: [
Color.fromARGB(100, 0, 0, 0),
Color.fromARGB(100, 0, 0, 0)
])),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
child: Center(
child: Text(
widget.model.duration,
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
),
);
}
Widget _badgeViews() {
return Positioned(
bottom: 6.0,
left: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [
0.7,
0.7
],
colors: [
Color.fromARGB(100, 0, 0, 0),
Color.fromARGB(100, 0, 0, 0)
])),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
child: Center(
child: Text(
_showViews(),
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
),
);
}
Widget _badgeDate() {
return Positioned(
bottom: 6.0,
right: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [
0.7,
0.7
],
colors: [
Color.fromARGB(100, 0, 0, 0),
Color.fromARGB(100, 0, 0, 0)
])),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 6.0),
child: Center(
child: Text(
_showDate(),
style: TextStyle(color: Colors.white, fontFamily: 'Eina'),
),
),
),
),
),
);
}
Widget _imageCover() {
return Container(
height: MediaQuery.of(context).size.height / 4,
width: MediaQuery.of(context).size.width,
child: FadeInImage.memoryNetwork(
image: widget.model.cover,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
);
}
Widget _headerLive() {
return Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
_imageCover(),
_badgeDuration(),
_badgeViews(),
_badgeDate()
],
);
}
Widget _userImageLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Container(
width: 40.0,
height: 40.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(50.0),
child: FadeInImage.memoryNetwork(
image: widget.model.userPicture,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
);
}
Widget _tagsLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
Widget _infoLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.model.user, style: TextStyle(fontFamily: 'Eina')),
Text(widget.model.description,
style: TextStyle(fontSize: 13.0, fontFamily: 'Biotif Book')),
Text(widget.model.game,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[700],
fontFamily: 'Shapiro')),
_tagsLive()
],
),
);
}
Widget _bottomLive() {
return Row(
children: <Widget>[_userImageLive(), _infoLive()],
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Container(
width: 370.0,
child: InkWell(
onTap: () {},
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Column(
children: <Widget>[_headerLive(), _bottomLive()],
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/live_tile_small.dart
|
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/live.dart';
class LiveTileSmall extends StatefulWidget {
final LiveModel model;
LiveTileSmall({Key key, @required this.model}) : super(key: key);
@override
_FollowingTileState createState() => _FollowingTileState();
}
class _FollowingTileState extends State<LiveTileSmall> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K';
}
Widget _userPicture() {
return Container(
height: 20.0,
width: 20.0,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15)),
child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: widget.model.userPicture,
fit: BoxFit.cover,
),
),
);
}
Widget _liveImage() {
return Container(
width: 120.0,
height: 70.0,
child: Stack(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(3.0)),
child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: widget.model.cover,
fit: BoxFit.cover,
),
),
Positioned(
bottom: 3.0,
left: 3.0,
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Container(
color: Colors.red,
width: 10.0,
height: 10.0,
),
),
SizedBox(width: 5.0),
Text(
_showViews(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 13.0),
)
],
),
)
],
),
);
}
Widget _liveHeader() {
return Row(
children: <Widget>[
_userPicture(),
SizedBox(
width: 5.0,
),
Text(
widget.model.user,
style: TextStyle(fontFamily: 'Eina', fontSize: 16.0),
)
],
);
}
Widget _liveMiddle() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.model.description,
style: TextStyle(fontSize: 16.0, fontFamily: 'Biotif Book'),
),
Text(
widget.model.game,
style: TextStyle(
fontSize: 13.0, color: Colors.grey[700], fontFamily: 'Shapiro'),
)
],
);
}
Widget _liveBottom() {
return Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
);
}
@override
Widget build(BuildContext context) {
print('Quantidade: ${widget.model.tags.length}');
return Padding(
padding: const EdgeInsets.only(right: 20.0, top: 15.0),
child: InkWell(
onTap: () {},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_liveImage(),
SizedBox(width: 10.0),
Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_liveHeader(),
SizedBox(height: 5.0),
_liveMiddle(),
SizedBox(height: 5.0),
_liveBottom()
],
),
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/clip_tile_large.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/model/clips.dart';
import 'package:twitch_clone/utils/constants.dart';
import 'package:twitch_clone/utils/custom_icons.dart';
class ClipTileLarge extends StatefulWidget {
final ClipsModel model;
final String categorie;
ClipTileLarge({Key key, this.model, this.categorie}) : super(key: key);
@override
_ClipTileLargeState createState() => _ClipTileLargeState();
}
class _ClipTileLargeState extends State<ClipTileLarge> {
String _showViews() {
return widget.model.views < 1000
? '${widget.model.views} views'
: '${(widget.model.views / 1000).toStringAsFixed(1)}K views';
}
Widget _topInfo() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Row(
children: <Widget>[_userImageLive(), _infoLive()],
)
],
),
Container(
padding: const EdgeInsets.only(top: 20.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(CustomIcons.favorite_border),
onPressed: () {},
),
IconButton(
icon: Icon(CustomIcons.more_vert),
onPressed: () {},
)
],
),
)
],
);
}
Widget _middleInfo() {
return Padding(
padding: const EdgeInsets.only(top: 10),
child: Container(
height: MediaQuery.of(context).size.height / 4,
width: MediaQuery.of(context).size.width,
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[_imageCover(), _views(), _duration()],
),
),
);
}
Widget _bottomInfo() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(10.0, 15.0, 0.0, 15.0),
child: Text(widget.model.description, style: TextStyle(fontFamily: 'Eina', fontSize: 16.0),),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 10.0),
width: MediaQuery.of(context).size.width / 2.1,
child: _actionButton('Watch full video', () {}),
),
Container(
padding: EdgeInsets.only(right: 10.0),
width: MediaQuery.of(context).size.width / 2.1,
child: _actionButton('Share', () {})
),
SizedBox(height: 80.0)
],
)
],
);
}
Widget _userImageLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Container(
width: 50.0,
height: 50.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(50.0),
child: FadeInImage.memoryNetwork(
image: widget.model.userImage,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
);
}
Widget _infoLive() {
return Padding(
padding: const EdgeInsets.only(top: 10.0, left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.model.user,
style: TextStyle(fontFamily: 'Eina', fontSize: 16.0)),
Text(widget.model.date,
style: TextStyle(
fontSize: 14.0,
color: Colors.grey[700],
fontFamily: 'Shapiro')),
Text(widget.model.categorie,
style: TextStyle(
fontSize: 14.0,
color: Colors.grey[700],
fontFamily: 'Shapiro'))
],
),
);
}
Widget _imageCover() {
return FadeInImage.memoryNetwork(
image: widget.model.cover,
placeholder: kTransparentImage,
fit: BoxFit.cover,
);
}
Widget _views() {
return Positioned(
bottom: 6.0,
left: 15.0,
child: Text(
_showViews(),
style: TextStyle(fontFamily: 'Eina'),
),
);
}
Widget _duration() {
return Positioned(
bottom: 6.0,
right: 15.0,
child: Text(
widget.model.duration,
style: TextStyle(fontFamily: 'Eina'),
),
);
}
Widget _actionButton(String text, Function function) {
return MaterialButton(
onPressed: function,
color: Constants.isDark ? Colors.grey[600] : Colors.grey[300],
child: Text(text, style: TextStyle(fontFamily: 'Eina')),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)
)
);
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_topInfo(), _middleInfo(), _bottomInfo()],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/channel_tile_medium.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/model/channel.dart';
class ChannelTileSmall extends StatefulWidget {
final ChannelModel model;
ChannelTileSmall({Key key, @required this.model}) : super(key: key);
@override
_ChannelTileState createState() => _ChannelTileState();
}
class _ChannelTileState extends State<ChannelTileSmall> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(right: 20.0),
child: ListTile(
onTap: () {},
leading: Container(
width: 40.0,
height: 40.0,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(50.0)),
child: FadeInImage.memoryNetwork(
image: widget.model.image,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
title: Text(
widget.model.user,
style: TextStyle(fontFamily: 'Eina', fontSize: 16.0),
),
subtitle: Text(
widget.model.newVideos <= 1
? '${widget.model.newVideos} new video'
: '${widget.model.newVideos} new videos',
style: TextStyle(
fontSize: 13.0, color: Colors.grey[700], fontFamily: 'Shapiro'),
),
trailing: Visibility(
visible: widget.model.newVideos > 0,
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Container(
color: Colors.grey[400],
width: 10.0,
height: 10.0,
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/components/categories_tile_medium.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/categories.dart';
class CategorieTileMedium extends StatefulWidget {
final CategoriesModel model;
CategorieTileMedium({Key key, @required this.model}) : super(key: key);
@override
_CategorieTileMediumState createState() => _CategorieTileMediumState();
}
class _CategorieTileMediumState extends State<CategorieTileMedium> {
String _showViews() {
return widget.model.views < 1000
? widget.model.views.toString()
: '${(widget.model.views / 1000).toStringAsFixed(1)}K Viewers';
}
Widget _categoryImage() {
return Container(
width: 130.0,
height: 185.0,
child: FadeInImage.memoryNetwork(
image: widget.model.image,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
);
}
Widget _categoryName() {
return Flexible(
child: Container(
width: 130.0,
padding: const EdgeInsets.only(right: 5.0),
child: Text(widget.model.name,
overflow: TextOverflow.fade,
maxLines: 1,
softWrap: false,
style: TextStyle(fontFamily: 'Eina', fontSize: 14.0)),
),
);
}
Widget _categoryViews() {
return Padding(
padding: const EdgeInsets.only(top: 3.0),
child: Text(
_showViews(),
style: TextStyle(fontFamily: 'Shapiro', fontSize: 12.0),
),
);
}
Widget _categoryTags() {
return Padding(
padding: const EdgeInsets.only(top: 6.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(right: 5.0, left: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_categoryImage(),
_categoryName(),
_categoryViews(),
_categoryTags()
],
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/model/live.dart
|
import 'package:flutter/material.dart';
class LiveModel {
String user;
String description;
String game;
String cover;
String userPicture;
int views;
List tags;
String date;
String duration;
LiveModel(
{@required this.user,
@required this.description,
@required this.game,
@required this.cover,
@required this.userPicture,
@required this.views,
@required this.tags,
this.date,
this.duration});
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/model/channel.dart
|
import 'package:flutter/material.dart';
class ChannelModel {
String user;
String image;
int newVideos;
ChannelModel({
@required this.user,
@required this.image,
@required this.newVideos
});
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/model/clips.dart
|
class ClipsModel {
String user;
String userImage;
String date;
String categorie;
String cover;
int views;
String duration;
String description;
bool isFavorite;
ClipsModel(
{this.user,
this.userImage,
this.date,
this.categorie,
this.cover,
this.views,
this.description,
this.duration,
this.isFavorite});
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/model/categories.dart
|
import 'package:flutter/material.dart';
class CategoriesModel {
String name;
String image;
int views;
int follow;
List tags;
bool favorite = false;
CategoriesModel(
{@required this.name,
@required this.image,
@required this.views,
@required this.tags,
this.follow,
this.favorite});
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/controller/live.dart
|
import 'package:flutter/cupertino.dart';
import 'package:twitch_clone/model/live.dart';
class LiveController extends ChangeNotifier {
List<LiveModel> lives = [
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-01',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-02',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-03',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-04',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-05',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-06',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-07',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-08',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-09',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-10',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-11',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-12',
duration: '01:45:22'),
LiveModel(
user: 'YoDa',
description: 'Meczada na Stream do YoDa',
game: 'League Of Legends',
userPicture:
'https://s2.glbimg.com/quLD8NyVUbYm87D55EDih_QzB48=/0x600/s.glbimg.com/po/tt2/f/original/2019/03/11/capa_1.png',
cover:
'https://1290779820.rsc.cdn77.org/screenshots/league-of-legends-636764988260065305.jpg',
tags: ['Moba', 'Multiplayer'],
views: 12145,
date: '2019-10-14',
duration: '01:45:22'),
LiveModel(
user: 'pimpimenta',
description: 'BIRI IRL AHAHAHAHAH',
game: 'Just Chatting',
userPicture:
'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQM4NCRln1i8k8Y98kNXGXj_IZin-MESwxCRlUuxhxaSRomkXRI',
cover: 'https://imgur.com/EapAOWe.jpg',
tags: ['Portuguese'],
views: 2732,
date: '2019-10-18',
duration: '01:45:22')
];
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/controller/channel.dart
|
import 'package:flutter/material.dart';
import 'package:twitch_clone/model/channel.dart';
class ChannelController extends ChangeNotifier {
List<ChannelModel> channel = [
ChannelModel(
user: 'alanzoka',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRmI2ckayYfoO6ft7h_2ZVoaM9doeUZMxjBZREDM2PjfdZyTrI1',
newVideos: 2
),
ChannelModel(
user: 'gratis150ml',
image: 'https://static-cdn.jtvnw.net/jtv_user_pictures/774dcf07-a145-4fdf-8f5d-2e2f24a7cb0f-profile_image-300x300.png',
newVideos: 1
),
ChannelModel(
user: 'jukes',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRF8cFIeJcfyfF8hQsTyhIn1Y5pTA0evVGiJAHYONh-e2X9RksX',
newVideos: 7
),
ChannelModel(
user: 'YoDa',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSv4ILwbM3CrlL88uVl6OpsBmw69dItR-GfR1O9IQjyvRmr3Ww0',
newVideos: 2
),
ChannelModel(
user: 'pimpimenta',
image: 'https://i.imgur.com/uxbpr9c.png',
newVideos: 0
),
ChannelModel(
user: 'BrTT',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTKLSL-3uZMjgoFivZzS91VdaYu0Thk8XPC6FQDTyJm4KA7JyGZ',
newVideos: 3
),
ChannelModel(
user: 'PatoPapao',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSMSUNertZY90EGEZbijy4Etu_KYW-vVc4GVlgK1WrKoct55krA',
newVideos: 0
),
ChannelModel(
user: 'Ninja',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSFUo1fczbOWzeLQG4kX1zJ1R9lzXjA9zBaz5kGt-shaH_RIRGe',
newVideos: 0
)
];
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/controller/clips.dart
|
import 'package:flutter/material.dart';
import 'package:twitch_clone/model/clips.dart';
class ClipsController extends ChangeNotifier {
List<ClipsModel> list = [
ClipsModel(
userImage: 'https://i.imgur.com/6idgurj.jpg',
user: 'Jukes',
date: 'Nov 17',
categorie: 'categorie',
isFavorite: false,
cover: 'https://i.imgur.com/fxW4aZ7.jpg',
views: 84578,
duration: '0:34',
description: 'Jukes explicando a jogada'),
ClipsModel(
userImage: 'https://i.imgur.com/Sb4OFnq.jpg',
user: 'YoDa',
date: 'Nov 25',
categorie: 'categorie',
isFavorite: false,
cover: 'https://i.imgur.com/kZcMpeJ.jpg',
views: 98451,
duration: '0:22',
description: 'n/a brotheragem kkkkkkkkkkkkk'),
ClipsModel(
userImage: 'https://i.imgur.com/AeTmZf2.jpg',
user: 'Rakin',
date: 'Dec 08',
categorie: 'categorie',
isFavorite: false,
cover: 'https://i.imgur.com/4xFichS.jpg',
views: 79548,
duration: '0:48',
description: 'MAIN VLAD VOLTOU'),
];
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/controller/categories.dart
|
import 'package:flutter/widgets.dart';
import 'package:twitch_clone/model/categories.dart';
class CategoriesController extends ChangeNotifier {
List<CategoriesModel> categories = [
CategoriesModel(
name: 'Fortnite',
image: 'https://cdn.mos.cms.futurecdn.net/cbMSAnmNj4eFfES9SCFeeX-1200-80.jpg',
views: 90580,
tags: ['Shooter'],
follow: 49658,
favorite: false
),
CategoriesModel(
name: 'Just Chatting',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQGxq3wt82b7kllXIRSkpvBVj8M7y_g5MhDfx_GDYSLvri72v9K',
views: 84785,
tags: ['IRL'],
follow: 65874,
favorite: false
),
CategoriesModel(
name: 'Call of Duty: Modern Warfare',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQOsJsbTmfEJ52uviSHBLjeAJnl1PEIMkXpqXBO1-YvERa8t4HE',
views: 107548,
tags: ['FPS', 'Shooter'],
follow: 72314,
favorite: false
),
CategoriesModel(
name: 'Minecraft',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRxcLo8WOTxYYYdGRJjSUoEwsc-gp5gUcD5H1wNugD8EfShQcDR',
views: 9784,
tags: ['Adventure Game'],
follow: 11231,
favorite: false
),
CategoriesModel(
name: 'Grand Theft Auto V',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQJrIBskeYyxHtXL_IF8vcSKrdCDi8fZv91vVmJX1qfWVrjL4sf',
views: 47587,
tags: ['Simulator'],
follow: 52135,
favorite: false
),
CategoriesModel(
name: 'FIFA 20',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR7tBHkBPsDjawRDdRcI4Hdi69jyCUzZ_0FqHVdW4KBDoFdR7kN',
views: 10548,
tags: ['Sport Game'],
follow: 84355,
favorite: false
),
CategoriesModel(
name: 'League of Legends',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSNhAjvFY8QUsZyEI38_mfeXj9KKDlSC9VfxQ8VpjYtWX7b9TR0',
views: 101784,
tags: ['MOBA'],
follow: 23473,
favorite: false
),
CategoriesModel(
name: 'Apex Legends',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRd7zUrx-oHGqvPfJUoNJM4et2LB3_mFzOhx0jx4zqpi3kzXukE',
views: 23548,
tags: ['FPS', 'Shooter'],
follow: 23423,
favorite: false
),
CategoriesModel(
name: 'World of Warcraft',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSCS9ChDcmmDfmHIls9PBxQRKpGJxXL86c8-Ke13QLdw20Cw7-2',
views: 24405,
tags: ['MMORPG', 'RPG'],
follow: 99564,
favorite: false
)
];
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/utils/custom_icons.dart
|
import 'package:flutter/widgets.dart';
class CustomIcons {
// http://fluttericon.com/
CustomIcons._();
static const _kFontFam = 'CustomIcons';
static const IconData cast = const IconData(0xe800, fontFamily: _kFontFam);
static const IconData favorite_border = const IconData(0xe801, fontFamily: _kFontFam);
static const IconData notifications_none = const IconData(0xe802, fontFamily: _kFontFam);
static const IconData comment = const IconData(0xe803, fontFamily: _kFontFam);
static const IconData search = const IconData(0xe804, fontFamily: _kFontFam);
static const IconData favorite = const IconData(0xe805, fontFamily: _kFontFam);
static const IconData more_vert = const IconData(0xe806, fontFamily: _kFontFam);
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib
|
mirrored_repositories/Twitch-Clone-Flutter/lib/utils/constants.dart
|
import 'package:flutter/material.dart';
class Constants {
static bool isDark = false;
static String appName = "Twitch Clone";
static String profilePicture = 'https://imgur.com/YWXOvSi.jpg';
//Colors for theme
static Color lightPrimary = Color(0xfffcfcff);
static Color darkPrimary = Colors.black;
static Color lightAccent = Color.fromARGB(255, 100, 65, 164);
static Color darkAccent = Color.fromARGB(255, 100, 65, 164);
static Color lightBG = Color(0xfffcfcff);
static Color darkBG = Colors.black;
static Color ratingBG = Colors.yellow[600];
static Color badgeColor = Color(0xfd71e18);
static Color twitchMainColor = Color.fromARGB(255, 100, 65, 164);
static ThemeData lightTheme = ThemeData(
backgroundColor: lightBG,
primaryColor: lightPrimary,
accentColor: lightAccent,
cursorColor: lightAccent,
scaffoldBackgroundColor: lightBG,
appBarTheme: AppBarTheme(
textTheme: TextTheme(
title: TextStyle(
color: darkBG,
fontSize: 18.0,
fontWeight: FontWeight.w800,
),
),
// iconTheme: IconThemeData(
// color: lightAccent,
// ),
),
);
static ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
backgroundColor: darkBG,
primaryColor: darkPrimary,
accentColor: darkAccent,
scaffoldBackgroundColor: darkBG,
cursorColor: darkAccent,
appBarTheme: AppBarTheme(
textTheme: TextTheme(
title: TextStyle(
color: lightBG,
fontSize: 18.0,
fontWeight: FontWeight.w800,
),
),
// iconTheme: IconThemeData(
// color: darkAccent,
// ),
),
);
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/browse/browse.dart
|
import 'package:flutter/material.dart';
import 'package:twitch_clone/ui/browse/tabs/tab_categories.dart';
import 'package:twitch_clone/ui/browse/tabs/tab_live_channels.dart';
import 'package:twitch_clone/utils/constants.dart';
class Browse extends StatefulWidget {
@override
_BrowseState createState() => _BrowseState();
}
class _BrowseState extends State<Browse> with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
_tabController = new TabController(length: 2, vsync: this);
super.initState();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0, top: 15.0),
child: Text(
'Browse',
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
fontFamily: 'Schelter'),
),
),
TabBar(
controller: _tabController,
labelColor: Constants.twitchMainColor,
indicatorColor: Constants.twitchMainColor,
unselectedLabelColor: Constants.isDark ? Colors.white : Colors.black,
indicatorSize: TabBarIndicatorSize.label,
tabs: <Widget>[
Tab(
child: Text('Categories', style: TextStyle(fontFamily: 'Eina')),
),
Tab(
child: Text('Live Channels', style: TextStyle(fontFamily: 'Eina')),
)
],
),
Expanded(
child: TabBarView(
children: <Widget>[TabCategories(), TabLiveChannels()],
controller: _tabController,
),
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/browse
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/browse/tabs/tab_live_channels.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/live_tile_large.dart';
import 'package:twitch_clone/controller/live.dart';
class TabLiveChannels extends StatefulWidget {
@override
_TabLiveChannelsState createState() => _TabLiveChannelsState();
}
class _TabLiveChannelsState extends State<TabLiveChannels> {
Widget _liveList() {
LiveController controller = Provider.of<LiveController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
itemCount: controller.lives.length,
itemBuilder: (context, index) {
return LiveTileLarge(model: controller.lives[index]);
},
);
}
@override
Widget build(BuildContext context) {
return ListView(
children: <Widget>[
Consumer<LiveController>(
builder: (context, liveController, widget) {
return _liveList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/browse
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/browse/tabs/tab_categories.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/categories_tile_small.dart';
import 'package:twitch_clone/controller/categories.dart';
import 'package:twitch_clone/ui/categories/categories.dart';
class TabCategories extends StatelessWidget {
@override
Widget build(BuildContext context) {
Widget _categoriesList() {
CategoriesController controller =
Provider.of<CategoriesController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: controller.categories.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
Categories(model: controller.categories[index]))),
child: CategoriesTileSmall(model: controller.categories[index]));
},
);
}
return ListView(
padding: const EdgeInsets.symmetric(vertical: 5.0),
children: <Widget>[
Consumer<CategoriesController>(
builder: (context, categorieControler, widget) {
return _categoriesList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/discover/discover.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/categories_tile_medium.dart';
import 'package:twitch_clone/components/live_tile_medium.dart';
import 'package:twitch_clone/controller/categories.dart';
import 'package:twitch_clone/controller/live.dart';
import 'package:twitch_clone/ui/categories/categories.dart';
import 'package:twitch_clone/utils/constants.dart';
class Discover extends StatefulWidget {
@override
_DiscoverState createState() => _DiscoverState();
}
class _DiscoverState extends State<Discover> {
int _currentPage = 0;
PageController _controllerLiveMedium;
Widget _titleDiscover() {
return Padding(
padding: const EdgeInsets.only(right: 20.0, top: 15.0),
child: Text(
'Discover',
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
fontFamily: 'Schelter'),
),
);
}
Widget _recomendedCategories() {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Row(
children: <Widget>[
Text(
'RECOMMENDED ',
style: TextStyle(fontFamily: 'Eina'),
),
Text(
'CATEGORIES',
style:
TextStyle(color: Constants.twitchMainColor, fontFamily: 'Eina'),
)
],
),
);
}
Widget _categoriesList() {
CategoriesController controller =
Provider.of<CategoriesController>(context);
return Container(
height: 260.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: controller.categories.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Categories(
model: controller.categories[index],
))),
child: CategorieTileMedium(model: controller.categories[index]));
},
),
);
}
Widget _mediumLiveList() {
LiveController controller = Provider.of<LiveController>(context);
return Container(
height: 330.0,
child: PageView.builder(
onPageChanged: (int index) {
setState(() {
_currentPage = index;
});
},
controller: _controllerLiveMedium,
itemCount: controller.lives.length,
itemBuilder: (context, index) {
return LiveTileMedium(model: controller.lives[index]);
},
),
);
}
Widget _genericHeader(String text) {
return Padding(
padding: const EdgeInsets.only(top: 25.0, bottom: 10.0),
child: Text(
text,
style: TextStyle(fontFamily: 'Eina'),
),
);
}
@override
void initState() {
super.initState();
_controllerLiveMedium =
PageController(initialPage: 0, keepPage: false, viewportFraction: 0.85);
}
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.only(left: 15.0),
children: <Widget>[
_titleDiscover(),
_genericHeader('RECOMENDED LIVE CHANNELS'),
Consumer<LiveController>(
builder: (context, liveController, widget) {
return _mediumLiveList();
},
),
_recomendedCategories(),
Consumer<CategoriesController>(
builder: (context, categorieController, widget) {
return _categoriesList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories/categories.dart
|
import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:twitch_clone/components/text_tag.dart';
import 'package:twitch_clone/model/categories.dart';
import 'package:twitch_clone/ui/browse/tabs/tab_live_channels.dart';
import 'package:twitch_clone/ui/categories/tabs/tab_clips.dart';
import 'package:twitch_clone/ui/categories/tabs/tab_videos.dart';
import 'package:twitch_clone/utils/constants.dart';
import 'package:twitch_clone/utils/custom_icons.dart';
class Categories extends StatefulWidget {
final CategoriesModel model;
Categories({Key key, this.model}) : super(key: key);
@override
_CategoriesState createState() => _CategoriesState();
}
class _CategoriesState extends State<Categories>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
_tabController = new TabController(length: 3, vsync: this);
super.initState();
}
String _convertNumber(int number) {
return number < 1000
? number.toString()
: '${(number / 1000).toStringAsFixed(1)}K';
}
Widget _actionButtons(IconData icon, Function function) {
return IconButton(
icon: Icon(icon),
onPressed: function,
);
}
Widget _imageCover() {
return Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
height: 140.0,
width: 100.0,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
child: FadeInImage.memoryNetwork(
image: widget.model.image,
placeholder: kTransparentImage,
fit: BoxFit.cover,
),
),
),
);
}
Widget _categorieInfo() {
return Expanded(
child: Container(
height: 155.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_topInfo(), _middleInfo(), _bottomInfo()],
),
),
);
}
Widget _topInfo() {
return Text(widget.model.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontFamily: 'Eina', fontSize: 25.0));
}
Widget _middleInfo() {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_middleText(widget.model.views, 'Viewers'),
SizedBox(width: 5.0),
_middleText(widget.model.follow, 'Followers')
],
);
}
Widget _middleText(int number, String text) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(_convertNumber(number),
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Shapiro',
fontSize: 15.0,
color: Constants.isDark ? Colors.white : Colors.black)),
Text(' $text',
style: TextStyle(
fontFamily: 'Shapiro',
fontSize: 15.0,
color: Colors.grey[600])),
],
);
}
Widget _bottomInfo() {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_categoryTags()],
);
}
Widget _categoryTags() {
return Padding(
padding: const EdgeInsets.only(top: 6.0),
child: Container(
height: 20.0,
child: ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: widget.model.tags.length,
itemBuilder: (BuildContext context, int index) {
return TextTag(text: widget.model.tags[index]);
},
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: <Widget>[
_actionButtons(CustomIcons.cast, () {}),
_actionButtons(CustomIcons.favorite_border, () {}),
],
elevation: 0.0,
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[_imageCover(), _categorieInfo()],
),
TabBar(
controller: _tabController,
labelColor: Constants.twitchMainColor,
indicatorColor: Constants.twitchMainColor,
unselectedLabelColor:
Constants.isDark ? Colors.white : Colors.black,
indicatorSize: TabBarIndicatorSize.label,
tabs: <Widget>[
Tab(
child: Text('Live Channels',
style: TextStyle(fontFamily: 'Eina'))),
Tab(child: Text('Videos', style: TextStyle(fontFamily: 'Eina'))),
Tab(child: Text('Clips', style: TextStyle(fontFamily: 'Eina')))
],
),
Expanded(
child: TabBarView(
controller: _tabController,
children: <Widget>[
TabLiveChannels(),
TabVideos(),
TabClips(categorie: widget.model.name),
],
),
)
],
),
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories/tabs/tab_videos.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/video_tile_medium.dart';
import 'package:twitch_clone/controller/live.dart';
class TabVideos extends StatefulWidget {
@override
_TabVideosState createState() => _TabVideosState();
}
class _TabVideosState extends State<TabVideos> {
@override
Widget build(BuildContext context) {
Widget _videosList() {
LiveController controller = Provider.of<LiveController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: controller.lives.length,
itemBuilder: (context, index) {
return VideoTileMedium(model: controller.lives[index]);
},
);
}
return ListView(
padding: const EdgeInsets.symmetric(vertical: 5.0),
children: <Widget>[
Consumer<LiveController>(
builder: (context, videoController, widget) {
return _videosList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories/tabs/tab_live_channels.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/live_tile_large.dart';
import 'package:twitch_clone/controller/live.dart';
class TabLiveChannels extends StatefulWidget {
@override
_TabLiveChannelsState createState() => _TabLiveChannelsState();
}
class _TabLiveChannelsState extends State<TabLiveChannels> {
@override
Widget build(BuildContext context) {
Widget _categoriesList() {
LiveController controller =
Provider.of<LiveController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: controller.lives.length,
itemBuilder: (context, index) {
return LiveTileLarge(model: controller.lives[index]);
},
);
}
return ListView(
padding: const EdgeInsets.symmetric(vertical: 5.0),
children: <Widget>[
Consumer<LiveController>(
builder: (context, categorieControler, widget) {
return _categoriesList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/categories/tabs/tab_clips.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/clip_tile_large.dart';
import 'package:twitch_clone/controller/clips.dart';
class TabClips extends StatefulWidget {
final String categorie;
TabClips({Key key, this.categorie}) : super(key: key);
@override
_TabClipsState createState() => _TabClipsState();
}
class _TabClipsState extends State<TabClips> {
Widget _clipsList() {
ClipsController controller = Provider.of<ClipsController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: controller.list.length,
itemBuilder: (context, index) {
return ClipTileLarge(
model: controller.list[index], categorie: widget.categorie);
});
}
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.symmetric(vertical: 5.0),
children: <Widget>[
Consumer<ClipsController>(
builder: (context, clipController, widget) {
return _clipsList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui
|
mirrored_repositories/Twitch-Clone-Flutter/lib/ui/following/following.dart
|
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:twitch_clone/components/channel_tile_medium.dart';
import 'package:twitch_clone/components/live_tile_small.dart';
import 'package:twitch_clone/controller/channel.dart';
import 'package:twitch_clone/controller/live.dart';
class Following extends StatefulWidget {
@override
_FollowingState createState() => _FollowingState();
}
class _FollowingState extends State<Following> {
Widget _followingList() {
LiveController controller = Provider.of<LiveController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
itemCount: controller.lives.length,
itemBuilder: (context, index) {
return LiveTileSmall(model: controller.lives[index]);
},
);
}
Widget _channelList() {
ChannelController controller = Provider.of<ChannelController>(context);
return ListView.builder(
primary: false,
shrinkWrap: true,
itemCount: controller.channel.length,
itemBuilder: (context, index) {
return ChannelTileSmall(model: controller.channel[index]);
},
);
}
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.only(left: 15.0),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 20.0, top: 15.0),
child: Text(
'Following',
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
fontFamily: 'Schelter'),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Text('LIVE CHANNELS', style: TextStyle(fontFamily: 'Eina')),
),
Consumer<LiveController>(
builder: (context, liveController, widget) {
return _followingList();
},
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Text('OFFLINE CHANNELS', style: TextStyle(fontFamily: 'Eina'),),
),
Consumer<ChannelController>(
builder: (context, channelController, widget) {
return _channelList();
},
)
],
);
}
}
| 0
|
mirrored_repositories/Twitch-Clone-Flutter
|
mirrored_repositories/Twitch-Clone-Flutter/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:twitch_clone/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(TwitchClone());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/recipes-app/recipes
|
mirrored_repositories/recipes-app/recipes/lib/data.dart
|
import 'package:flutter/material.dart';
import '/models/category.dart';
import 'models/recipe.dart';
const List<Category> categories = [
Category(title: 'Ekadashi Special', color: Colors.amber),
Category(title: 'QuickBites', color: Colors.blue),
Category(title: 'Super Foods!', color: Colors.redAccent),
Category(title: 'Lovely Sweets', color: Colors.orange),
Category(title: 'Filling Salads', color: Colors.lime),
Category(title: 'Immunity Boosters', color: Colors.orange),
Category(title: 'Subji Satisfaction', color: Colors.greenAccent),
Category(title: 'Rolls and Rotis', color: Colors.deepPurple),
Category(title: 'Yummy Kanjis', color: Colors.amber),
Category(title: 'Street Sass!', color: Colors.redAccent),
Category(title: 'Soupy Goodness', color: Colors.cyanAccent),
];
List<Recipe> recipes = [
Recipe(
title: "Moong-Dal Paaysum",
categories: ['Lovely Sweets', 'Super Foods!'],
imageUrl: "assets/images/Moong-Dal Paaysum.jpg",
difficulty: RecipeDifficulty.human,
foodType: RecipeFoodType.satvik,
duration: 50,
preSteps: ["Soak the Moong Dal in Water for 3-4 hrs."],
steps: [
"Put the Moong Dal to Boil till it softens (Alternatively cook it in a cooker for 1-3 whistles).",
"Pour water in another vessel, let it boil, add the Jaggery, and let it simmer to make a sweet syrup",
"Add the Moong Dal, mix well, and let it cook for 5-10 minutes",
"Saute the Mewa and dry fruits in a pan with 1-2 Tbsp of Ghee till then.",
"Add in the Coconut Milk, little (not at all) of the dry-fruit and khoya mixture.",
"Cook on medium flame for another 5-10minutes",
"Finally Top off with remaining khoya, dry fruits and 1-2 tbsp of Ghee"
],
ingredients: [
"1 Cup Whole Green Moong dal",
"1 Cup Jaggery",
"1/4 Cup Water",
"1 Cup Milk (prefer Coconut Milk for a Rich Taste)",
"~100gm DryFruits (Optional)",
"~150gm Khoya/Mewa (Optional)",
],
isLactoseFree: false,
),
Recipe(
categories: [
'Street Sass!',
'QuickBites',
],
title: 'Spaghetti with Tomato Sauce',
duration: 20,
ingredients: [
'4 Tomatoes',
'1 Tablespoon of Olive Oil',
'1 Onion',
'250g Spaghetti',
'Spices',
'Cheese (optional)'
],
steps: [
'Cut the tomatoes and the onion into small pieces.',
'Boil some water - add salt to it once it boils.',
'Put the spaghetti into the boiling water - they should be done in about 10 to 12 minutes.',
'In the meantime, heaten up some olive oil and add the cut onion.',
'After 2 minutes, add the tomato pieces, salt, pepper and your other spices.',
'The sauce will be done once the spaghetti are.',
'Feel free to add some cheese on top of the finished dish.'
],
isLactoseFree: true,
difficulty: RecipeDifficulty.easy,
foodType: RecipeFoodType.tamsic,
imageUrl: "assets/images/Spaghetti with Tomato Sauce.jpg",
),
Recipe(
categories: [
'Street Sass!',
'QuickBites',
],
title: 'Toast Hawaii',
imageUrl: 'assets/images/Toast Hawaii.jpg',
duration: 10,
ingredients: [
'1 Slice White Bread',
'1 Slice Ham',
'1 Slice Pineapple',
'1-2 Slices of Cheese',
'Butter'
],
steps: [
'Butter one side of the white bread',
'Layer ham, the pineapple and cheese on the white bread',
'Bake the toast for round about 10 minutes in the oven at 200°C'
],
difficulty: RecipeDifficulty.cakewalk,
foodType: RecipeFoodType.tamsic,
isLactoseFree: false,
),
Recipe(
categories: [
'Street Sass!',
'QuickBites',
],
title: 'Classic Hamburger',
imageUrl: 'assets/images/Classic Hamburger.jpg',
duration: 45,
ingredients: [
'300g Cattle Hack',
'1 Tomato',
'1 Cucumber',
'1 Onion',
'Ketchup',
'2 Burger Buns'
],
steps: [
'Form 2 patties',
'Fry the patties for c. 4 minutes on each side',
'Quickly fry the buns for c. 1 minute on each side',
'Bruch buns with ketchup',
'Serve burger with tomato, cucumber and onion'
],
isLactoseFree: true,
difficulty: RecipeDifficulty.easy,
foodType: RecipeFoodType.tamsic,
),
Recipe(
title: 'Asparagus Salad with Cherry Tomatoes',
categories: ['Filling Salads', 'Ekadashi Special', 'Immunity Boosters'],
imageUrl: 'assets/images/Asparagus Salad with Cherry Tomatoes.jpg',
duration: 30,
ingredients: [
'White and Green Asparagus',
'30g Pine Nuts',
'300g Cherry Tomatoes',
'Salad',
'Salt, Pepper and Olive Oil'
],
steps: [
'Wash, peel and cut the asparagus',
'Cook in salted water',
'Salt and pepper the asparagus',
'Roast the pine nuts',
'Halve the tomatoes',
'Mix with asparagus, salad and dressing',
'Serve with Baguette'
],
difficulty: RecipeDifficulty.easy,
foodType: RecipeFoodType.satvik,
isLactoseFree: true,
),
Recipe(
title: 'Salad with Smoked Salmon',
categories: ['Filling Salads', 'Immunity Boosters'],
imageUrl: 'assets/images/Salad with Smoked Salmon.jpg',
duration: 15,
ingredients: [
'Arugula',
'Lamb\'s Lettuce',
'Parsley',
'Fennel',
'200g Smoked Salmon',
'Mustard',
'Balsamic Vinegar',
'Olive Oil',
'Salt and Pepper'
],
steps: [
'Wash and cut salad and herbs',
'Dice the salmon',
'Process mustard, vinegar and olive oil into a dessing',
'Prepare the salad',
'Add salmon cubes and dressing'
],
isLactoseFree: true,
difficulty: RecipeDifficulty.human,
foodType: RecipeFoodType.rajsic,
),
Recipe(
title: 'Sanjeevni',
categories: [
'Yummy Kanjis',
'Super Foods!',
'Lovely Sweets',
'Immunity Boosters'
],
imageUrl: 'assets/images/Sanjeevni.jpg',
duration: 15,
foodType: RecipeFoodType.satvik,
difficulty: RecipeDifficulty.easy,
ingredients: [
'2 tbsp of Isha Sanjeevni Health Mix (Alternative: Use Healthy flour like Ragi)',
'1 and a half cup of water (Use Coconut milk or any other, for a richer taste)',
'3-4 tbsp Jaggery (Reduce quantity if using unhealthy sugar instead)',
'Handful of Dry-Fruits (Optional)',
],
isLactoseFree: true,
steps: [
'Put 1 cup water to boil',
'Mix the Sanjeevni in the remaining Half a Cup of water to form a paste like consistency.',
'Add the paste to the boiling water, mix it, and allow it to cook for 5-8 min.',
'Cut the Dry Fruits, saute in 1-2 tsp of ghee. (Optional)',
'Put off the flame once the Sanjeevni has become moderately thick.',
'Tip: To Check for thickness, dip a spoon in the mix and raise it, the mixture should Break while dropping down, and not flow like water.',
'Mix in the Jaggery, taste a little to suit as per liking.',
'Add the Dry-Fruits in the glasses first, and then Add the Sanjeevni mixture. Enjoy!'
],
),
Recipe(
title: 'Amritam',
categories: [
'Filling Salads',
'Ekadashi Special',
'Lovely Sweets',
'Immunity Boosters'
],
imageUrl: 'assets/images/Amritam.jpg',
duration: 20,
foodType: RecipeFoodType.satvik,
difficulty: RecipeDifficulty.easy,
ingredients: [
'1/2 cup Whole Green Moong Dal',
'1/4 cup Kabuli Chana',
'Almonds and other dry-fruits of your liking.',
'~1 tbsp Jaggery',
'~2 tbsp Honey',
'Dates',
'Carrots, spinach and any other veggies of desire',
'Bananas (highly recommended), Pomegranate, Apples, and other fruits of your likes'
],
isLactoseFree: true,
preSteps: [
'Sprout the Moong Dal overnight',
'Soak the Dry Fruits',
'Soak the Dates in as little (drinkable) water as may be required, and do it in a separate vessel.'
'Soak the Kabuli for 3-4 hours.'
],
steps: [
'Put the Kabuli Chana to boil (Alternatively, cook in a pressure cooker until soft)',
'Repeat the same with the Moong Dal if you didn\'t sprout it, else DO NOT HEAT SPROUTS',
'Chop the Vegetables and Fruits and add them in a bowl.',
'Add in the Moong dal If it was sprouted',
'Add the Jaggery, along with 1-2 tsp of Ghee',
'Cut the Dry Fruits, add them in',
'Add the Dates, along with the water.',
'Strain the Boiled Kabuli Chana, add it in, and give a good mix.',
'Add in the Honey, mix well, thank Krishna for such a gorgeous meal, pat yourself for the hardwork. Now enjoy! :D'
]),
Recipe(
title: 'Poriyal',
categories: [
'Subji Satisfaction',
'Ekadashi Special',
'Super Foods!',
'Immunity Boosters',
'Soupy Goodness'
],
imageUrl: 'assets/images/Poriyal.jpg',
duration: 25,
foodType: RecipeFoodType.satvik,
difficulty: RecipeDifficulty.human,
ingredients: [
'3 cup carrots chopped',
'2 cups cabbage, finely chopped',
'1 cup green peas.',
'2 tbsp oil/ghee',
'2 tsp mustard seeds',
'2 tsp split black gram, skinless (Dhuli urad dal*)',
'2 dry red chillies, broken',
'8-10 curry leaves',
'4 tbsp coconut, grated',
'4 tsp lemon juice',
'Salt to taste'
],
isLactoseFree: true,
steps: [
'Heat the oil in a pan on medium heat. Add the mustard seeds and black gram. Stir lightly until the mustard seeds splutter and the gram is lightly browned.',
'Add the carrot, cabbage and peas; stir well',
'Add the red chillies and curry leaves; stir well',
'Remove from heat',
'Add the grated coconut, lemon juice and salt; mix well. Serve hot.',
],
),
Recipe(
title: 'Date Roll',
categories: [
'Lovely Sweets',
'Rolls and Rotis',
'Immunity Boosters',
],
imageUrl: 'assets/images/Date Roll.jpg',
duration: 30,
foodType: RecipeFoodType.rajsic,
difficulty: RecipeDifficulty.human,
ingredients: [
'15 dates',
'15 whole cashews',
'250g Refined Flour (Use Ragi or any other healthy flour if possible)',
'1/4 tsp baking powder',
'~150g Jaggery',
'125g Butter',
],
isLactoseFree: true,
steps: [
'Preheat the oven to 180C or 350F',
'Remove the seeds from the dates and stuff one cashew nut inside each date. The larger end of the cashew should be visble outside the date.'
'Sift the flour with the baking powder. Keep aside.',
'Put jaggery and butter in a bowl and beat until light and creamy.',
'Add the flour little by little, and mix well until a dough is formed.',
'Divide the dough into 15 portions and shape each into a ball.',
'Using the thumb, make a dent in the middle of the ball.',
'Place a stuffed date inside the ball, ensuring that it is only half covered wth the dough and the cashew is still visible.',
'Place on a reased baking tray at some distance from each other.',
'Bake for 25 minutes in the oven and remove.',
'Cool and serve',
],
),
Recipe(
title: 'Banana Roti',
categories: [
'Lovely Sweets',
'Rolls and Rotis',
'Super Foods!',
'Immunity Boosters',
],
imageUrl: 'assets/images/Banana Roti.jpg',
duration: 40,
foodType: RecipeFoodType.satvik,
difficulty: RecipeDifficulty.human,
ingredients: [
'2-3 ripe bananas, peeled, chopped',
'1 cup milk',
'2 tbsp podered sugar',
'3 cups wheat flour',
'2 tbsp oil/ghee',
'1/2 tsp salt'
],
isLactoseFree: true,
steps: [
'Blend the bananas in a blender',
'Add the milk and sugar and whisk until smooth. Set aside.',
'In a large bowl, combine the wheat flour and salt. Add the oil and then the banana misture.',
'Mix everything into pliable dough and let it rest for about half an hour.'
'Divide the dough into small portions and roll into balls.',
'Roll out into small chapattis/rotis',
'Roast tthem on a Tawa(griddle)until golden flecks show on both sides.',
'Serve Warm ;D'
],
),
];
| 0
|
mirrored_repositories/recipes-app/recipes
|
mirrored_repositories/recipes-app/recipes/lib/main.dart
|
// ignore_for_file: deprecated_member_use
import 'package:flutter/material.dart';
import 'package:my_recipes/data.dart';
import 'package:my_recipes/screens/filters_screen.dart';
import 'package:my_recipes/screens/homescreen.dart';
import 'package:my_recipes/screens/recipe_screen.dart';
import 'package:my_recipes/screens/recipes_screen.dart';
import 'models/recipe.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
// This widget is the root of your application.
List<Recipe> _filteredRecipes = recipes;
var _filters = {
'Satvik': {
'value': false,
'subtitle': 'Healthy Pranic Superfoods! 🍲',
},
'Simple': {
'value': false,
'subtitle': 'Easy to Make, Delicious to taste! 🧑🍳',
},
'Quick': {
'value': false,
'subtitle': 'Be the Flash, in a Flash! 🌩',
},
'Lactose Free': {
'value': false,
'subtitle': 'Seeing off all of them cows! 😝',
},
};
void _updateFilters(var filters) {
setState(() {
_filters = filters;
_filterRecipes();
});
}
void _filterRecipes() {
bool satvik = _filters['Satvik']?['value'] as bool;
bool simple = _filters['Simple']?['value'] as bool;
bool quick = _filters['Quick']?['value'] as bool;
bool lactoseFree = _filters['Lactose Free']?['value'] as bool;
setState(() {
_filteredRecipes = recipes
.where((recipe) =>
(!satvik || recipe.foodType == RecipeFoodType.satvik) &&
(!quick || recipe.duration < 30) &&
(!simple ||
(recipe.difficulty != RecipeDifficulty.chef &&
recipe.difficulty != RecipeDifficulty.superHuman)) &&
(!lactoseFree || recipe.isLactoseFree))
.toList();
});
}
List<Recipe> get categories {
return recipes.where((Recipe) => false).toList();
}
void _toggleFavorite(Recipe recipe) {
setState(() {
if (_filteredRecipes.contains(recipe)) {
_filteredRecipes[_filteredRecipes.indexOf(recipe)].isFavorite =
_filteredRecipes[_filteredRecipes.indexOf(recipe)].isFavorite
? false
: true;
}
});
}
// bool _isFavorite(Recipe recipe) {
// return _filteredRecipes.contains(recipe) &&
// _filteredRecipes[_filteredRecipes.indexOf(recipe)].isFavorite;
// }
void _getFilters() => _filters;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.pink,
accentColor: Colors.amber,
),
appBarTheme: AppBarTheme(
titleTextStyle: Theme.of(context).textTheme.headline6?.copyWith(
fontFamily: 'Raleway',
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
canvasColor: const Color.fromRGBO(255, 254, 229, 1),
fontFamily: 'Raleway',
textTheme: ThemeData.light().textTheme.copyWith(
bodyText1: const TextStyle(color: Color.fromRGBO(20, 51, 51, 1)),
bodyText2: const TextStyle(color: Color.fromRGBO(20, 51, 51, 1)),
headline6: const TextStyle(
fontSize: 20,
fontFamily: 'RobotoCondensed',
fontWeight: FontWeight.w700,
),
),
),
routes: {
"/": (ctx) => Homescreen(
availableRecipes: _filteredRecipes,
), // Route: BuilderFunction(context)
RecipesScreen.route: (ctx) => RecipesScreen(
filteredRecipes: _filteredRecipes,
),
RecipeScreen.route: (ctx) => RecipeScreen(toggleFav: _toggleFavorite),
FiltersScreen.route: (ctx) => FiltersScreen(
getFilters: _getFilters, updateFilters: _updateFilters),
},
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/widgets/recipes_item.dart
|
import 'package:flutter/material.dart';
import '../models/recipe.dart';
class RecipesItem extends StatelessWidget {
const RecipesItem({Key? key, required this.recipe}) : super(key: key);
final Recipe recipe;
String get difficultyText {
switch (recipe.difficulty) {
case RecipeDifficulty.cakewalk:
return 'CakeWalk';
case RecipeDifficulty.easy:
return 'Easy';
case RecipeDifficulty.human:
return 'Human';
case RecipeDifficulty.superHuman:
return 'Super Human';
case RecipeDifficulty.chef:
return 'Chef';
default:
return "Unknown";
}
}
String get foodType {
switch (recipe.foodType) {
case RecipeFoodType.satvik:
return 'Satvik';
case RecipeFoodType.tamsic:
return 'Tamsic';
case RecipeFoodType.rajsic:
return 'Rajsic';
default:
return "Unknown";
}
}
@override
Widget build(BuildContext context) {
final headlineStyle = Theme.of(context)
.textTheme
.headline6
?.copyWith(fontSize: 15, fontWeight: FontWeight.normal);
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
elevation: 4,
margin: const EdgeInsets.all(10),
child: Column(children: [
Stack(
children: [
ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15), topRight: Radius.circular(15)),
child: Image.asset(
recipe.imageUrl,
fit: BoxFit.cover,
width: double.infinity,
height: 250,
),
),
Positioned(
bottom: 10,
right: 10,
child: Container(
alignment: Alignment.center,
width: 230,
padding: const EdgeInsets.all(10),
child: Text(
recipe.title,
style: const TextStyle(fontSize: 26, color: Colors.white),
softWrap: true,
overflow: TextOverflow.clip,
),
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.circular(5)),
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
children: [
const Icon(Icons.schedule),
const SizedBox(
width: 6,
),
Text(
"${recipe.duration} min",
style: headlineStyle,
)
],
),
Row(
children: [
const Icon(Icons.work),
const SizedBox(
width: 6,
),
Text(
difficultyText,
style: headlineStyle,
)
],
),
Row(
children: [
const Icon(Icons.health_and_safety),
const SizedBox(
width: 6,
),
Text(
foodType,
style: headlineStyle,
)
],
),
],
),
)
]),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/widgets/main_drawer.dart
|
import 'dart:ui';
import 'package:flutter/material.dart';
import '../screens/filters_screen.dart';
class MainDrawer extends StatelessWidget {
const MainDrawer({Key? key}) : super(key: key);
Widget buildListTile(String title, IconData icon, Function handler) {
return ListTile(
leading: Icon(icon, size: 26),
title: Text(
title,
style: const TextStyle(
fontSize: 24, fontWeight: FontWeight.w900, color: Colors.white),
),
onTap: () => handler(),
);
}
@override
Widget build(BuildContext context) {
return Drawer(
backgroundColor: Theme.of(context).colorScheme.primary,
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondary,
),
height: 100,
width: double.infinity,
alignment: Alignment.center,
child: Text(
'Chef\'s Deck 🍳',
style: Theme.of(context).textTheme.headline6?.copyWith(
fontSize: 30,
color: Colors.white,
fontFamily: 'RobotoCondensed'),
),
),
buildListTile('Recipes', Icons.restaurant,
() => Navigator.of(context).pushReplacementNamed('/')),
buildListTile(
'Filters',
Icons.restaurant_menu,
() => Navigator.of(context)
.pushReplacementNamed(FiltersScreen.route)),
],
),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/widgets/categories_item.dart
|
import 'package:flutter/material.dart';
import '../models/category.dart';
class CategoriesItem extends StatefulWidget {
final Category category;
const CategoriesItem({Key? key, required this.category}) : super(key: key);
@override
State<CategoriesItem> createState() => _CategoriesItemState();
}
class _CategoriesItemState extends State<CategoriesItem> {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
child: Text(
widget.category.title,
style: Theme.of(context).textTheme.headline6,
softWrap: true,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
widget.category.color.withOpacity(0.7),
widget.category.color.withOpacity(1),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(20),
),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/models/recipe.dart
|
enum RecipeDifficulty { cakewalk, easy, human, superHuman, chef }
enum RecipeFoodType { tamsic, rajsic, satvik }
class Recipe {
final String title;
final List<String> categories;
final List<String> preSteps;
final List<String> steps;
final List<String> ingredients;
final String imageUrl;
final RecipeDifficulty difficulty;
final RecipeFoodType foodType;
final int duration;
final bool isLactoseFree;
bool isFavorite = false;
Recipe(
{required this.title,
required this.categories,
required this.steps,
required this.ingredients,
required this.imageUrl,
required this.difficulty,
required this.foodType,
required this.duration,
this.preSteps = const [],
this.isLactoseFree = false});
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/models/category.dart
|
import 'package:flutter/material.dart';
class Category {
final String title;
final Color color;
const Category({required this.title, required this.color});
String get id {
return Object.hash(title, color).toString();
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/recipes_screen.dart
|
import 'package:flutter/material.dart';
import 'package:my_recipes/screens/recipe_screen.dart';
import 'package:my_recipes/widgets/recipes_item.dart';
import '../models/recipe.dart';
import '../models/category.dart';
class RecipesScreen extends StatelessWidget {
static const String route = '/recipes';
final List<Recipe> filteredRecipes;
const RecipesScreen({Key? key, required this.filteredRecipes})
: super(key: key);
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context)?.settings.arguments;
final Category category = routeArgs as Category;
final List<Recipe> categoryRecipes = filteredRecipes
.where((r) => r.categories.contains(category.title))
.toList();
return Scaffold(
appBar: AppBar(
title: Text(category.title),
),
body: ListView.builder(
itemBuilder: (ctx, index) => InkWell(
onTap: () => Navigator.of(context).pushNamed(RecipeScreen.route,
arguments: categoryRecipes[index]),
borderRadius: BorderRadius.circular(15),
child: RecipesItem(recipe: categoryRecipes[index])),
itemCount: categoryRecipes.length,
),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/favorites_screen.dart
|
import 'package:flutter/material.dart';
import '../models/recipe.dart';
import '../widgets/recipes_item.dart';
import 'recipe_screen.dart';
class FavoritesScreen extends StatefulWidget {
final List<Recipe> favorites;
const FavoritesScreen({
Key? key,
required this.favorites,
}) : super(key: key);
@override
State<FavoritesScreen> createState() => _FavoritesScreenState();
}
class _FavoritesScreenState extends State<FavoritesScreen> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return widget.favorites.isEmpty
? Center(
child: Text(
'No favorites Yet.. Consider Adding Some!',
style: Theme.of(context).textTheme.headline6,
),
)
: ListView.builder(
itemBuilder: (ctx, index) => InkWell(
onTap: () => Navigator.of(context)
.pushNamed(RecipeScreen.route,
arguments: widget.favorites[index])
.then((value) => Navigator.of(context)
.pushReplacementNamed('/', arguments: 1)),
borderRadius: BorderRadius.circular(15),
child: RecipesItem(recipe: widget.favorites[index])),
itemCount: widget.favorites.length,
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/homescreen.dart
|
import 'package:flutter/material.dart';
import 'package:my_recipes/screens/favorites_screen.dart';
import '../models/recipe.dart';
import '../widgets/main_drawer.dart';
import 'categories_screen.dart';
class Homescreen extends StatefulWidget {
const Homescreen({Key? key, required this.availableRecipes})
: super(key: key);
final List<Recipe> availableRecipes;
@override
_HomescreenState createState() => _HomescreenState();
}
class _HomescreenState extends State<Homescreen> {
late final List<Map<String, Object>> _pages;
int _selectedPage = -1;
@override
void initState() {
super.initState();
_pages = [
{'page': const CategoriesScreen(), 'title': 'Categories ✨'},
{
'page': FavoritesScreen(
favorites:
widget.availableRecipes.where((r) => r.isFavorite).toList(),
),
'title': 'Favorites 🌟'
},
];
}
void _changePage(int index) {
setState(() {
_selectedPage = index;
});
}
@override
Widget build(BuildContext context) {
if (_selectedPage == -1) {
var args = ModalRoute.of(context)?.settings.arguments;
_selectedPage = int.tryParse(args.toString()) != null ? args as int : 0;
}
return Scaffold(
appBar: AppBar(
title: Text(_pages[_selectedPage]['title'] as String),
),
body: _pages[_selectedPage]['page'] as Widget,
bottomNavigationBar: BottomNavigationBar(
onTap: _changePage,
items: [
BottomNavigationBarItem(
icon: const Icon(Icons.category),
label: 'Categories',
backgroundColor: Theme.of(context).colorScheme.primary),
BottomNavigationBarItem(
icon: const Icon(Icons.star),
label: 'Favorites',
backgroundColor: Theme.of(context).colorScheme.primary)
],
type: BottomNavigationBarType.shifting,
currentIndex: _selectedPage,
unselectedItemColor: Colors.white,
selectedItemColor: Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).primaryColor,
),
drawer: const MainDrawer(),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/recipe_screen.dart
|
import 'package:flutter/material.dart';
import 'package:my_recipes/models/recipe.dart';
class RecipeScreen extends StatefulWidget {
final Function toggleFav;
const RecipeScreen({Key? key, required this.toggleFav}) : super(key: key);
static const String route = 'recipe';
@override
State<RecipeScreen> createState() => _RecipeScreenState();
}
class _RecipeScreenState extends State<RecipeScreen> {
Widget buildSectionTitle(BuildContext context, String title) {
return Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 5),
child: Container(
alignment: Alignment.center,
child: Text(
title,
style: Theme.of(context).textTheme.headline6,
),
),
);
}
Widget buildContainer(Widget child, height) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(width: 5, color: Colors.grey)),
height: height,
width: 250,
alignment: Alignment.center,
child: child,
),
);
}
@override
Widget build(BuildContext context) {
final Recipe recipe = ModalRoute.of(context)?.settings.arguments as Recipe;
return Scaffold(
appBar: AppBar(
title: Text(recipe.title),
),
body: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: 250,
width: double.infinity,
child:
Image.asset(recipe.imageUrl, height: 300, fit: BoxFit.cover),
),
buildSectionTitle(context, 'Ingredients'),
buildContainer(
ListView.builder(
itemBuilder: (ctx, index) => Card(
child: Center(
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Text(recipe.ingredients[index],
style: Theme.of(context).textTheme.bodyText2),
),
),
color: Theme.of(context).colorScheme.secondary),
itemCount: recipe.ingredients.length,
),
150.0),
if (recipe.preSteps.isNotEmpty)
buildSectionTitle(context, 'Pre-Steps'),
if (recipe.preSteps.isNotEmpty)
buildContainer(
ListView.builder(
itemBuilder: (ctx, index) => Column(
children: [
ListTile(
leading: CircleAvatar(
child: Text('#${index + 1}'),
backgroundColor:
Theme.of(context).colorScheme.primary,
),
title: Text(recipe.preSteps[index]),
),
const Divider()
],
),
itemCount: recipe.preSteps.length,
),
100.0),
buildSectionTitle(context, 'Instructions'),
buildContainer(
ListView.builder(
itemBuilder: (ctx, index) => Column(
children: [
ListTile(
leading: CircleAvatar(
child: Text('#${index + 1}'),
backgroundColor:
Theme.of(context).colorScheme.secondary),
title: Text(recipe.steps[index]),
),
const Divider()
],
),
itemCount: recipe.steps.length,
),
160.0)
],
),
),
floatingActionButton: FloatingActionButton(
child: Icon(recipe.isFavorite ? Icons.star : Icons.star_border),
tooltip: 'Toggle Favorite 😊',
onPressed: () {
setState(() {
widget.toggleFav(recipe);
});
},
),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/categories_screen.dart
|
import 'package:flutter/material.dart';
import 'package:my_recipes/models/category.dart';
import 'package:my_recipes/screens/recipes_screen.dart';
import 'package:my_recipes/widgets/categories_item.dart';
import '../data.dart';
class CategoriesScreen extends StatelessWidget {
const CategoriesScreen({Key? key}) : super(key: key);
Widget wrapCategoryItem(BuildContext context, Category category) {
return InkWell(
child: CategoriesItem(category: category),
splashColor: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(20),
onTap: () {
Navigator.of(context)
.pushNamed(RecipesScreen.route, arguments: category)
.then((value) => Navigator.of(context).pushReplacementNamed('/'));
},
);
}
@override
Widget build(BuildContext context) {
return GridView(
padding: const EdgeInsets.all(20),
children: categories
.map((category) => wrapCategoryItem(context, category))
.toList(),
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
childAspectRatio: 1.5,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes/lib
|
mirrored_repositories/recipes-app/recipes/lib/screens/filters_screen.dart
|
import 'package:flutter/material.dart';
import '../widgets/main_drawer.dart';
class FiltersScreen extends StatefulWidget {
final Function getFilters;
final Function updateFilters;
const FiltersScreen(
{Key? key, required this.getFilters, required this.updateFilters})
: super(key: key);
static const String route = '/filters';
@override
State<FiltersScreen> createState() => _FiltersScreenState();
}
class _FiltersScreenState extends State<FiltersScreen> {
var filters;
Widget buildSwitchButtonTile(String title, String subtitle) {
return SwitchListTile(
title: Text(title, style: Theme.of(context).textTheme.headline6),
subtitle: Text(subtitle),
value: filters[title]['value'],
onChanged: (changed) {
setState(
() {
filters[title]['value'] = changed;
widget.updateFilters(filters);
},
);
},
);
}
@override
Widget build(BuildContext context) {
filters = widget.getFilters();
return Scaffold(
appBar: AppBar(
title: const Text('Filters'),
),
body: Column(
children: [
Container(
margin: const EdgeInsets.all(15),
child: Text(
'Cookery Hide-N-Seek',
style:
Theme.of(context).textTheme.headline6?.copyWith(fontSize: 30),
),
alignment: Alignment.center,
),
Expanded(
child: ListView(
children: (filters as Map)
.keys
.map(
(key) =>
buildSwitchButtonTile(key, filters[key]['subtitle']),
)
.toList(),
),
),
],
),
drawer: const MainDrawer(),
);
}
}
| 0
|
mirrored_repositories/recipes-app/recipes
|
mirrored_repositories/recipes-app/recipes/test/widget_test.dart
|
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:my_recipes/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0
|
mirrored_repositories/flutter-quick-wireframe-01
|
mirrored_repositories/flutter-quick-wireframe-01/lib/main.dart
|
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: MainScreen(),
));
class MainScreen extends StatefulWidget {
final List<Widget> contents = [
ContentWidget(),
ContentWidget(),
ContentWidget(),
ContentWidget(),
ContentWidget(),
];
@override
_MainScreenState createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
int _currentIndex = 2;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: Icon(
Icons.menu,
color: Colors.black87,
),
title: Text(
'Quick Wireframe',
style: TextStyle(color: Colors.black87),
),
),
bottomNavigationBar: BottomNavigationBar(
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
title: Text(''),
icon: Icon(
Icons.home,
color: Colors.black54,
)),
BottomNavigationBarItem(
title: Text(''),
icon: Icon(
Icons.search,
color: Colors.black54,
)),
BottomNavigationBarItem(
title: Text(''),
icon: Icon(
Icons.add,
color: Colors.black54,
)),
BottomNavigationBarItem(
title: Text(''),
icon: Icon(
Icons.favorite,
color: Colors.black54,
)),
BottomNavigationBarItem(
title: Text(''),
icon: Icon(
Icons.contacts,
color: Colors.black54,
)),
]),
body: widget.contents[_currentIndex],
);
}
}
class ContentWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
padding: const EdgeInsets.only(top: 16.0),
color: Colors.white,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(16.0),
child: Material(
child: ClipRRect(
borderRadius: BorderRadius.circular(12.0),
child: Image.asset('assets/nature.jpg'),
),
),
),
SizedBox(
height: 18.0,
),
Text(
'Beautiful Nature',
style: TextStyle(
fontSize: 32.0,
color: Colors.black87,
// fontWeight: FontWeight.bold,
fontFamily: 'SegoeUI'),
),
SizedBox(
height: 18.0,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'Whether you prefer to draw interfaces on paper, whiteboards, or napkins, Uizard transforms your wireframes to Sketch files according to your very own style guide 🎨',
style: TextStyle(
fontSize: 16.0,
color: Colors.black54,
),
strutStyle: StrutStyle(height: 1.2),
textAlign: TextAlign.justify,
),
),
SizedBox(
height: 12.0,
),
Text('Demo by Pete Houston'),
SizedBox(
height: 28.0,
),
ButtonTheme(
minWidth: MediaQuery.of(context).size.width - 32.0,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6.0))),
onPressed: () {},
textColor: Colors.white,
color: Colors.black,
elevation: 1.0,
child: Text(
'BUTTON',
style: TextStyle(
color: Colors.white,
fontFamily: 'SegoeUI',
letterSpacing: 3.0),
),
),
)
],
),
),
);
}
}
| 0
|
mirrored_repositories/rupiah
|
mirrored_repositories/rupiah/lib/main.dart
|
import 'package:expense_kit/features/investment/view_model/investments_cubit.dart';
import 'package:expense_kit/model/service/login_service.dart';
import 'package:expense_kit/view/router.dart';
import 'package:expense_kit/view_model/auth/auth_cubit.dart';
import 'package:expense_kit/view_model/category/category_cubit.dart';
import 'package:expense_kit/view_model/dashboard/dashboard_cubit.dart';
import 'package:expense_kit/view_model/mutual_fund/create/create_mf_cubit.dart';
import 'package:expense_kit/view_model/mutual_fund/mf_login/mf_login_cubit.dart';
import 'package:expense_kit/view_model/mutual_fund/mutual_fund_cubit.dart';
import 'package:expense_kit/view_model/savings/savings_cubit.dart';
import 'package:expense_kit/view_model/settings/settings_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
void main() {
runApp(const ProviderScope(child: MyApp()));
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
LoginService.init();
super.initState();
}
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => AuthCubit()..validateLogin(),
),
BlocProvider(
create: (context) => SettingsCubit()..init(),
),
BlocProvider(
create: (context) => DashboardCubit(),
),
BlocProvider(
create: (context) => SavingsCubit(
dashboardCubit: context.read<DashboardCubit>(),
)..getFunds(),
),
BlocProvider(
create: (context) => MutualFundCubit(),
),
BlocProvider(
create: (context) => CreateMfCubit(),
),
BlocProvider(
create: (context) => CategoryCubit()..get(),
),
BlocProvider(
create: (context) => MfLoginCubit(
savingsCubit: context.read<SavingsCubit>(),
),
),
BlocProvider(
create: (context) => InvestmentsCubit(),
),
],
child: BlocBuilder<SettingsCubit, SettingsState>(
buildWhen: (previous, current) => current is ThemeChanged,
builder: (context, state) {
var textTheme = Theme.of(context).textTheme;
if (state is ThemeChanged && state.brightness == Brightness.dark) {
textTheme = Theme.of(context).primaryTextTheme;
} else {
textTheme = Theme.of(context).textTheme;
}
return MaterialApp.router(
title: 'Rupiah',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: state is ThemeChanged ? state.brightness : Brightness.light,
),
useMaterial3: true,
textTheme: GoogleFonts.openSansTextTheme(textTheme),
),
routerConfig: router,
);
},
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib
|
mirrored_repositories/rupiah/lib/view/decorations.dart
|
import 'package:flutter/material.dart';
InputDecoration textDecoration = const InputDecoration(
floatingLabelBehavior: FloatingLabelBehavior.always,
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueGrey),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueGrey),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueGrey),
),
);
| 0
|
mirrored_repositories/rupiah/lib
|
mirrored_repositories/rupiah/lib/view/router.dart
|
import 'package:expense_kit/features/investment/view/add_investment.dart';
import 'package:expense_kit/model/entity/expense_entity.dart';
import 'package:expense_kit/view/account/account_list.dart';
import 'package:expense_kit/view/account/add_account.dart';
import 'package:expense_kit/view/category/add_category.dart';
import 'package:expense_kit/view/category/category_list.dart';
import 'package:expense_kit/view/emi/add_emi.dart';
import 'package:expense_kit/view/expense/add_expense.dart';
import 'package:expense_kit/view/home/home.dart';
import 'package:expense_kit/view/savings/mf_login/mf_login.dart';
import 'package:expense_kit/view/savings/mutual_fund/create_fund.dart';
import 'package:expense_kit/view/savings/mutual_fund/mutual_funds_page.dart';
import 'package:go_router/go_router.dart';
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const Home(),
),
GoRoute(
path: AddAccount.route,
builder: (context, state) => const AddAccount(),
),
GoRoute(
path: AccountsList.route,
builder: (context, state) => const AccountsList(),
),
GoRoute(
path: AddExpense.route,
builder: (context, state) => AddExpense(
expenseEntity: state.extra != null ? state.extra as ExpenseEntity : null,
),
),
GoRoute(
path: AddEMI.route,
builder: (context, state) => const AddEMI(),
),
GoRoute(
path: MutualFundPage.route,
builder: (context, state) => const MutualFundPage(),
),
GoRoute(
path: CreateFund.route,
builder: (context, state) => const CreateFund(),
),
GoRoute(
path: AddCategory.route,
builder: (context, state) => const AddCategory(),
),
GoRoute(
path: CategoryList.route,
builder: (context, state) => const CategoryList(),
),
GoRoute(
path: MFLogin.route,
builder: (context, state) => const MFLogin(),
),
GoRoute(
path: AddInvestment.route,
builder: (context, state) => const AddInvestment(),
),
],
);
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/emi/add_emi.dart
|
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:expense_kit/model/entity/emi_entity.dart';
import 'package:expense_kit/utils/currency_utils.dart';
import 'package:expense_kit/utils/ui_extensions.dart';
import 'package:expense_kit/view/decorations.dart';
import 'package:expense_kit/view_model/emi/create_emi_state.dart';
import 'package:expense_kit/view_model/emi/emi_list_state.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import 'package:jiffy/jiffy.dart';
class AddEMI extends ConsumerStatefulWidget {
static const route = '/add-emi';
const AddEMI({super.key});
@override
ConsumerState<AddEMI> createState() => _AddEMIState();
}
class _AddEMIState extends ConsumerState<AddEMI> {
TextEditingController dateController = TextEditingController();
int count = 0;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
ref.listen(emiState, (previous, next) {
if (next.endDate != null) {
dateController.text = DateFormat.yMMM().format(next.endDate!);
}
});
final CurrencyTextInputFormatter formatter = CurrencyTextInputFormatter(
symbol: '${CurrencyUtils.currencySymbol} ',
locale: 'en_IN',
);
var uiState = ref.read(emiState.notifier);
EMIEntity emiEntity = ref.watch(emiState);
return Scaffold(
appBar: AppBar(
title: const Text('Add EMI'),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: SafeArea(
child: ListView(
children: [
TextField(
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
style: context.titleMedium(),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
formatter,
],
decoration: textDecoration.copyWith(
labelText: 'EMI Amount',
hintText: '$currencySymbol 0.00',
labelStyle: context.titleLarge(),
),
onChanged: (value) {
uiState.amount(
formatter.getUnformattedValue().toDouble(),
);
},
),
const SizedBox(height: 32),
TextField(
style: context.titleMedium(),
decoration: textDecoration.copyWith(
labelText: 'Pending EMIs',
hintText: '0',
labelStyle: context.titleLarge(),
),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
onChanged: (value) {
if (value.isNotEmpty) {
count = int.parse(value);
var jiffy = Jiffy.now().add(
months: int.parse(value) - 1,
);
if (kDebugMode) {
print(jiffy.dateTime);
}
uiState.updateEMI(emiEntity.copyWith(
endDate: jiffy.dateTime,
));
}
},
),
const SizedBox(height: 32),
TextField(
controller: dateController,
style: context.titleMedium(),
readOnly: true,
decoration: textDecoration.copyWith(
labelText: 'EMI End Date',
labelStyle: context.titleLarge(),
),
onChanged: (value) {},
),
const SizedBox(height: 32),
TextField(
style: context.body(),
decoration: textDecoration.copyWith(
labelText: 'Description',
hintText: 'Optional',
labelStyle: context.titleLarge(),
),
onChanged: (value) {
uiState.updateEMI(emiEntity.copyWith(
description: value,
));
},
),
],
),
),
),
bottomNavigationBar: BottomAppBar(
child: SafeArea(
child: Row(
children: [
Expanded(
child: TextButton(
onPressed: () {
ref.invalidate(emiState);
context.pop();
},
child: const Text('Cancel'),
),
),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 4,
),
onPressed: emiEntity.amount > 0 && emiEntity.endDate != null
? () {
ref
..read(emiState.notifier).addEMI(emiEntity, count)
..invalidate(emiState)
..read(emiListProvider.notifier).getAll();
context.pop();
}
: null,
child: const Text('Add Expense'),
),
),
],
),
),
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/emi/emi_view.dart
|
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:expense_kit/model/entity/emi_entity.dart';
import 'package:expense_kit/utils/currency_utils.dart';
import 'package:expense_kit/utils/ui_extensions.dart';
import 'package:expense_kit/view/emi/add_emi.dart';
import 'package:expense_kit/view_model/emi/emi_list_state.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
class EMIView extends ConsumerStatefulWidget {
const EMIView({super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() => _EMIViewState();
}
class _EMIViewState extends ConsumerState<EMIView> {
final CurrencyTextInputFormatter formatter = CurrencyTextInputFormatter(
symbol: '$currencySymbol ',
locale: 'en_IN',
decimalDigits: 2,
);
@override
void initState() {
super.initState();
ref.read(emiListProvider.notifier).getAll();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Existing EMIs'),
actions: [
IconButton(
onPressed: () => ref.read(emiListProvider.notifier).sort(),
icon: Icon(
ref.read(emiListProvider.notifier).asc
? Icons.arrow_downward_sharp
: Icons.arrow_upward_sharp,
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () => context.push(AddEMI.route),
child: const Icon(Icons.add),
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Expanded(
child: Text(
'Total',
style: context.body(),
),
),
Expanded(
child: Text(
formatter.formatDouble(
ref.read(emiListProvider.notifier).totalAmount(),
),
textAlign: TextAlign.end,
style: context.boldBody(),
),
),
],
),
),
),
),
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: ref.watch(emiListProvider).length,
itemBuilder: (context, index) {
EMIEntity entity = ref.watch(emiListProvider)[index];
return ListTile(
onLongPress: () {
showCupertinoModalPopup(
context: context,
builder: (context) => CupertinoActionSheet(
actions: [
CupertinoActionSheet(
title: Text(
formatter.formatDouble(entity.amount),
),
message: const Text(
'Deletion is a permanent action.',
),
),
CupertinoActionSheetAction(
onPressed: () {},
child: const Text('Edit'),
),
CupertinoActionSheetAction(
onPressed: () {
ref.read(emiListProvider.notifier).delete(entity);
Navigator.pop(context);
HapticFeedback.heavyImpact();
},
isDestructiveAction: true,
child: const Text('Delete'),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
),
);
HapticFeedback.mediumImpact();
},
title: Row(
children: [
Expanded(
child: Text(
entity.description?.toString() ?? 'EMI',
style: context.body(),
),
),
Expanded(
child: Text(
formatter.formatDouble(entity.amount),
textAlign: TextAlign.end,
style: context.boldBody(),
),
),
],
),
subtitle: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
entity.formattedDate(),
style: context.small(),
),
Text(
entity.pending().toCurrency(),
style: context.mediumBold(),
),
],
),
leading: Container(
padding: const EdgeInsets.all(8),
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
),
child: const Icon(
Icons.currency_rupee,
color: Colors.white,
size: 16,
),
),
);
},
),
),
],
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/emi/loan_card.dart
|
import 'package:expense_kit/model/entity/emi_entity.dart';
import 'package:expense_kit/utils/currency_utils.dart';
import 'package:expense_kit/utils/ui_extensions.dart';
import 'package:expense_kit/view_model/emi/emi_list_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class LoanCard extends ConsumerWidget {
const LoanCard({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final List<EMIEntity> loans = ref.watch(emiListProvider);
var notifier = ref.read(emiListProvider.notifier);
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Container(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Debt',
),
const SizedBox(height: 4),
Text(
formatter.formatDouble(notifier.pending()),
style: context.titleLarge(),
),
],
),
const Divider(),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: loans.length,
itemBuilder: (context, index) {
EMIEntity entity = loans[index];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
entity.description ?? 'Loan ${index + 1}',
style: context.smallBold(),
),
const SizedBox(height: 3),
Text(
formatter.formatDouble(entity.amount),
style: context.small(),
),
],
),
Text(
entity.pending().toCurrency(),
style: context.mediumBold()?.copyWith(
color: Colors.red,
),
),
],
),
Text(
'${entity.pendingMonths()} months emi pending',
style: context.smaller()?.copyWith(
color: Colors.grey.withOpacity(0.5),
),
),
],
),
);
},
),
// const SizedBox(height: 16),
// const Row(
// children: [
// Expanded(
// child: Row(
// children: [
// Text(
// 'Income',
// ),
// SizedBox(width: 16),
// Icon(
// Icons.trending_up,
// color: Colors.green,
// )
// ],
// ),
// ),
// Expanded(
// child: Row(
// children: [
// Text(
// 'Expense',
// ),
// SizedBox(width: 16),
// Icon(
// Icons.trending_down,
// color: Colors.red,
// )
// ],
// ),
// ),
// ],
// ),
// Row(
// children: [
// Expanded(
// child: Text(
// '+ ${formatter.formatDouble(value.income)}',
// style: context.titleMedium(),
// ),
// ),
// Expanded(
// child: Text(
// '- ${formatter.formatDouble(value.expense)}',
// style: context.titleMedium(),
// ),
// ),
// ],
// ),
],
),
),
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/components/custom_icon.dart
|
import 'package:flutter/material.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
class CustomIcon extends StatelessWidget {
final String? iconCode;
final double? size;
const CustomIcon({super.key, required this.iconCode, this.size});
@override
Widget build(BuildContext context) {
return Icon(
IconData(
int.parse(iconCode ?? MdiIcons.currencyRupee.codePoint.toString()),
fontFamily: 'Material Design Icons',
fontPackage: 'material_design_icons_flutter',
),
size: size,
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/components/icon_picker.dart
|
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
class IconPicker extends StatelessWidget {
final ValueChanged<String> onSelect;
const IconPicker({super.key, required this.onSelect});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: SafeArea(
child: ListView.builder(
itemCount: icons.length,
itemBuilder: (context, index) {
MapEntry<String, List<IconData>> entry =
icons.entries.elementAt(index);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(entry.key),
),
Wrap(
children: entry.value
.map(
(IconData e) => IconButton.filledTonal(
onPressed: () {
context.pop();
onSelect(e.codePoint.toString());
},
icon: Icon(e),
),
)
.toList(),
)
],
);
},
),
),
);
}
}
final icons = {
"Animal": [
MdiIcons.butterfly,
MdiIcons.cat,
MdiIcons.cow,
MdiIcons.dog,
MdiIcons.dogSide,
MdiIcons.duck,
MdiIcons.fish,
MdiIcons.horse,
MdiIcons.owl,
MdiIcons.panda,
MdiIcons.pig,
MdiIcons.sheep,
MdiIcons.rabbit,
MdiIcons.snail,
MdiIcons.snake,
MdiIcons.spider,
MdiIcons.tortoise,
MdiIcons.turtle,
MdiIcons.turkey,
],
"Brands": [
MdiIcons.android,
MdiIcons.angular,
MdiIcons.apple,
MdiIcons.atlassian,
MdiIcons.aws,
MdiIcons.bitbucket,
MdiIcons.bitcoin,
MdiIcons.blenderSoftware,
MdiIcons.bootstrap,
MdiIcons.codepen,
MdiIcons.devTo,
MdiIcons.deviantart,
MdiIcons.docker,
MdiIcons.dropbox,
MdiIcons.evernote,
MdiIcons.facebook,
MdiIcons.firebase,
MdiIcons.firefox,
MdiIcons.github,
MdiIcons.gitlab,
MdiIcons.gmail,
MdiIcons.google,
MdiIcons.googleAds,
MdiIcons.googleDrive,
MdiIcons.googlePlay,
MdiIcons.hulu,
MdiIcons.instagram,
MdiIcons.jira,
MdiIcons.kickstarter,
MdiIcons.languageSwift,
MdiIcons.linkedin,
MdiIcons.microsoft,
MdiIcons.microsoftAzure,
MdiIcons.nintendoSwitch,
MdiIcons.onepassword,
MdiIcons.pandora,
MdiIcons.patreon,
MdiIcons.pinterest,
MdiIcons.qqchat,
MdiIcons.reddit,
MdiIcons.skype,
MdiIcons.snapchat,
MdiIcons.soundcloud,
MdiIcons.spotify,
MdiIcons.steam,
MdiIcons.wechat,
MdiIcons.whatsapp,
MdiIcons.wikipedia,
MdiIcons.wordpress,
MdiIcons.youtube,
],
"Computer": [
MdiIcons.album,
MdiIcons.audioVideo,
MdiIcons.earbuds,
MdiIcons.headphones,
MdiIcons.musicNote,
MdiIcons.speaker,
MdiIcons.printer,
MdiIcons.radio,
MdiIcons.wifi,
MdiIcons.bluetooth,
MdiIcons.phone,
MdiIcons.laptop,
MdiIcons.desktopClassic,
MdiIcons.televisionSpeaker,
MdiIcons.videoVintage,
MdiIcons.film,
MdiIcons.camcorder,
MdiIcons.video,
MdiIcons.webcam,
MdiIcons.camera,
],
"Food": [
MdiIcons.carrot,
MdiIcons.chiliMild,
MdiIcons.corn,
MdiIcons.egg,
MdiIcons.foodApple,
MdiIcons.fruitGrapes,
MdiIcons.fruitCherries,
],
"Health": [
MdiIcons.pillMultiple,
MdiIcons.needle,
MdiIcons.motherNurse,
MdiIcons.truckPlus,
MdiIcons.medication,
MdiIcons.hospitalBuilding,
MdiIcons.emoticonSick,
],
"Shopping": [
MdiIcons.basket,
MdiIcons.cart,
MdiIcons.cash,
MdiIcons.creditCard,
MdiIcons.sale,
MdiIcons.shopping,
MdiIcons.store,
MdiIcons.cashRegister,
MdiIcons.cartVariant,
],
"Transportation": [
MdiIcons.airplane,
MdiIcons.car,
MdiIcons.ferry,
MdiIcons.taxi,
MdiIcons.tram,
MdiIcons.train,
MdiIcons.bus,
],
"Other": [
MdiIcons.circle,
MdiIcons.circleHalf,
MdiIcons.heart,
MdiIcons.hexagon,
MdiIcons.decagram,
MdiIcons.shape,
MdiIcons.hexagonMultiple,
MdiIcons.triangle,
MdiIcons.shapePlus,
],
};
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/components/circular_indicator.dart
|
import 'package:flutter/material.dart';
class CircularIndicator extends StatelessWidget {
const CircularIndicator({super.key});
@override
Widget build(BuildContext context) {
return const Center(
child: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
strokeWidth: 3,
),
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view
|
mirrored_repositories/rupiah/lib/view/components/add_button.dart
|
import 'package:flutter/material.dart';
class AddButton extends StatelessWidget {
final VoidCallback onTap;
final double? width;
final double? height;
final bool horizontal;
const AddButton(
{super.key,
required this.onTap,
required this.width,
this.horizontal = false,
required this.height});
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(
side: BorderSide(
color: Theme.of(context).colorScheme.surfaceVariant,
),
borderRadius: const BorderRadius.all(
Radius.circular(4),
),
),
child: InkWell(
borderRadius: BorderRadius.circular(4),
onTap: onTap,
child: SizedBox(
width: width,
height: height,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: horizontal
? const Row(
children: [
Icon(
Icons.add,
size: 16,
),
Text(
'Add',
style: TextStyle(
fontSize: 16,
),
),
],
)
: const Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.add,
size: 16,
),
Text(
'Add',
style: TextStyle(
fontSize: 16,
),
),
],
),
),
),
),
);
}
}
| 0
|
mirrored_repositories/rupiah/lib/view/components
|
mirrored_repositories/rupiah/lib/view/components/color_picker/color_picker.dart
|
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class ColorPicker extends StatelessWidget {
final ValueChanged<String> onSelect;
const ColorPicker({super.key, required this.onSelect});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: SafeArea(
child: Wrap(
children: colors
.map(
(int e) => IconButton.filledTonal(
onPressed: () {
context.pop();
print(Colors.red.value);
onSelect(e.toString());
},
icon: Container(
decoration: BoxDecoration(
color: Color(e),
borderRadius: BorderRadius.circular(32),
),
width: 24,
height: 24,
),
),
)
.toList(),
),
),
);
}
}
List<int> colors = [
0xFF191970, // Midnight Blue
0xFF0000CD, // Medium Blue
0xFF4169E1, // Royal Blue
0xFF4682B4, // Steel Blue
0xFF87CEEB, // Sky Blue
0xFF00CED1, // Dark Turquoise
0xFF20B2AA, // Light Sea Green
0xFF008080, // Teal
0xFF008B8B, // Dark Cyan
0xFF00FFFF, // Cyan
0xFF7FFFD4, // Aquamarine
0xFF00FF7F, // Spring Green
0xFFADFF2F, // Green Yellow
0xFF32CD32, // Lime Green
0xFF228B22, // Forest Green
0xFF006400, // Dark Green
0xFF8FBC8F, // Dark Sea Green
0xFF556B2F, // Dark Olive Green
0xFFBDB76B, // Dark Khaki
0xFFDAA520, // Goldenrod
0xFFFFD700, // Gold
0xFFB8860B, // Dark Goldenrod
0xFFFFA500, // Orange
0xFFFF4500, // Orange Red
0xFFB22222, // Fire Brick
0xFFDC143C, // Crimson
0xFF8B0000, // Dark Red
0xFFA9A9A9, // Dark Gray
0xFF808080, // Gray
];
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.