repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/tuna_rungu_apps/lib | mirrored_repositories/tuna_rungu_apps/lib/pages/login.dart | import 'package:flutter/material.dart';
import 'package:tuna_rungu_apps/pages/home.dart';
import 'package:tuna_rungu_apps/pages/register.dart';
// Firebase
import 'package:firebase_auth/firebase_auth.dart';
Route _createRoute() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const RegisterPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final emailController = TextEditingController();
final passwordController = TextEditingController();
var _isObscure = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF9FAFB),
body: CustomScrollView(
slivers: [
SliverFillRemaining(
hasScrollBody: false,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
color: const Color(0xFFFFF4D2),
child: Padding(
padding: const EdgeInsets.only(top: 24, bottom: 16),
child: SafeArea(
child: Center(
child: Column(
children: const [
Image(
image: AssetImage('assets/images/logo.png'),
height: 120,
width: 120,
),
Text(
"Selamat datang",
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
SizedBox(
height: 10,
),
Text(
"Mulai belajar bahasa isyarat",
style: TextStyle(
color: Color(0xFF667085),
fontSize: 16,
),
),
],
),
),
),
),
),
const SizedBox(
height: 32,
),
Expanded(
child: Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Email",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.w500,
fontSize: 14,
),
),
const SizedBox(
height: 6,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
child: TextField(
style: const TextStyle(fontSize: 16),
controller: emailController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Email",
contentPadding: EdgeInsets.only(
left: 14, right: 14, top: 10, bottom: 10),
),
),
),
const SizedBox(
height: 20,
),
const Text(
"Password",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.w500,
fontSize: 14,
),
),
const SizedBox(
height: 6,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
child: TextField(
style: const TextStyle(fontSize: 16),
obscureText: _isObscure,
controller: passwordController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Password",
contentPadding: const EdgeInsets.only(
left: 14, right: 14, top: 10, bottom: 10),
suffixIcon: IconButton(
onPressed: () {
setState(() {
if (_isObscure == true) {
_isObscure = false;
} else {
_isObscure = true;
}
});
},
icon: Icon(
_isObscure
? Icons.visibility
: Icons.visibility_off,
),
),
),
),
),
const SizedBox(
height: 40,
),
Flexible(
child: Align(
alignment: const Alignment(0, 1),
child: InkWell(
onTap: () async {
try {
final credential = await FirebaseAuth.instance
.signInWithEmailAndPassword(
email: emailController.text,
password: passwordController.text);
if (credential.user != null) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) {
return HomePage(
email:
credential.user?.email as String,
displayName:
credential.user?.displayName ==
null
? "Guest"
: credential.user?.displayName
as String,
photoURL:
credential.user?.photoURL == null
? ""
: credential.user?.photoURL
as String,
);
}),
);
}
} on FirebaseAuthException catch (e) {
showDialog(
context: context,
builder: (context) {
return LoginPopUp(msg: e.code);
},
);
}
},
child: Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFF5A21D),
border: Border.all(
color: const Color(0xFFF5A21D),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 16),
child: const Text(
"Masuk",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Belum punya akun?"),
TextButton(
onPressed: () {
Navigator.of(context).push(_createRoute());
},
child: const Text(
"Daftar",
style: TextStyle(
color: Color(0xFF0589D6),
),
),
),
],
),
],
),
),
),
],
),
),
],
),
);
}
}
class LoginPopUp extends StatefulWidget {
final String msg;
const LoginPopUp({Key? key, required this.msg}) : super(key: key);
@override
State<LoginPopUp> createState() => _LoginPopUpState();
}
class _LoginPopUpState extends State<LoginPopUp> {
@override
Widget build(BuildContext context) {
return AlertDialog(
content: Text(widget.msg),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('Kembali'),
)
],
);
}
}
| 0 |
mirrored_repositories/tuna_rungu_apps/lib | mirrored_repositories/tuna_rungu_apps/lib/pages/imbuhan.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:iconsax/iconsax.dart';
import 'package:video_player/video_player.dart';
class ImbuhanPage extends StatelessWidget {
const ImbuhanPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5A21D),
body: SafeArea(
child: Container(
height: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
color: Colors.white,
),
padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
iconSize: 24,
padding: const EdgeInsets.all(0),
alignment: Alignment.centerLeft,
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Iconsax.arrow_left,
),
color: const Color(0xFF475467),
),
const Text(
"Kembali",
style: TextStyle(
color: Color(0xFF475467),
fontSize: 16,
),
),
],
),
const SizedBox(
height: 16,
),
const Text(
"Imbuhan",
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
const SizedBox(
height: 8,
),
const Flexible(
child: Text(
"Belajar bahasa isyarat imbuhan dengan video tutorial",
style: TextStyle(
color: Color(0xFF667085),
fontSize: 14,
),
),
),
const SizedBox(
height: 32,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.685,
child: const ImbuhanContainer(),
),
],
),
),
),
);
}
}
class ImbuhanContainer extends StatelessWidget {
const ImbuhanContainer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
FirebaseFirestore db = FirebaseFirestore.instance;
CollectionReference imbuhan = db.collection('imbuhan');
return FutureBuilder<QuerySnapshot>(
future: imbuhan.get(),
builder: (_, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return AlignedGridView.count(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
itemCount: snapshot.data!.docs.length,
itemBuilder: (BuildContext ctx, index) {
return InkWell(
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: VideoPop(
linkVideo: snapshot.data?.docs[index]['link'],
namaVideo: snapshot.data?.docs[index]['nilai'],
),
),
),
child: Column(
children: [
Container(
height: 160,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
image: const DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
'https://firebasestorage.googleapis.com/v0/b/imk-kel-1.appspot.com/o/imbuhan%2Fthumbnail%20imbuhan.png?alt=media&token=05f2d435-881b-41d5-9197-2dd6b10a1c4e'),
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.5,
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
),
child: Text(
snapshot.data?.docs[index]['nilai'],
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
],
),
);
},
);
},
);
}
}
class VideoPop extends StatefulWidget {
final String linkVideo;
final String namaVideo;
const VideoPop({Key? key, required this.linkVideo, required this.namaVideo})
: super(key: key);
@override
State<VideoPop> createState() => _VideoPopState();
}
class _VideoPopState extends State<VideoPop> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(widget.linkVideo);
_controller.addListener(() {
setState(() {});
});
_controller.setLooping(true);
_controller.initialize();
_controller.play();
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: Stack(
children: <Widget>[
VideoPlayer(_controller),
],
),
),
const SizedBox(
height: 24,
),
Text(
widget.namaVideo,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const SizedBox(
height: 24,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFFFFF),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 14),
child: const Text(
"Keluar",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}
| 0 |
mirrored_repositories/tuna_rungu_apps/lib | mirrored_repositories/tuna_rungu_apps/lib/pages/home.dart | import 'package:flutter/material.dart';
import 'package:tuna_rungu_apps/pages/hurufangka.dart';
import 'package:iconsax/iconsax.dart';
import 'package:tuna_rungu_apps/pages/imbuhan.dart';
import 'package:tuna_rungu_apps/pages/kosakata.dart';
import 'package:tuna_rungu_apps/pages/profile.dart';
import 'package:tuna_rungu_apps/pages/tambahkata.dart';
Route _createRoute() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const HurufAngkaPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
Route _createRouteProfile(String displayName, String email, String photoURL) {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => ProfilePage(
displayName: displayName,
email: email,
photoURL: photoURL,
),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
Route _createRouteKataIsyarat() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const KosakataPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
Route _createRouteImbuhan() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const ImbuhanPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
Route _createRouteTambahKata() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => TambahKataPage(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.ease;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
class HomePage extends StatelessWidget {
final String displayName;
final String email;
final String photoURL;
const HomePage(
{Key? key,
required this.displayName,
required this.email,
required this.photoURL})
: super(key: key);
String getInitials(String displayName) => displayName.isNotEmpty
? displayName.trim().split(RegExp(' +')).map((s) => s[0]).take(2).join()
: '';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF9FAFB),
body: SingleChildScrollView(
child: Column(
children: [
Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(24),
),
color: Color(0xFFF5A21D)),
child: Stack(
alignment: Alignment.bottomRight,
children: [
SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Halo, ${displayName.toString()}",
style: const TextStyle(
color: Color(0xFFF2F4F7),
fontSize: 16,
),
),
InkWell(
onTap: () {
Navigator.of(context)
.push(_createRouteProfile(
displayName,
email,
photoURL,
));
},
child: CircleAvatar(
backgroundColor: const Color(0xFFFFFCF2),
foregroundColor: const Color(0xFFDB8818),
child: photoURL == ""
? Text(
getInitials(displayName),
)
: Image.network(
photoURL,
fit: BoxFit.fill,
),
),
),
],
),
const SizedBox(
height: 10,
),
const SizedBox(
width: 200,
child: Text(
"Ayo belajar bahasa isyarat",
style: TextStyle(
color: Color(0xFFFCFCFD),
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
),
const SizedBox(
height: 16,
),
],
),
),
),
const Image(
image: AssetImage('assets/images/reading-book.png'),
height: 106,
width: 185,
),
],
),
),
Padding(
padding: const EdgeInsets.all(16),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
color: const Color(0xFFF1FEFE),
border: Border.all(
color: const Color(0xFFEAECF0),
),
),
child: Padding(
padding: const EdgeInsets.only(
left: 16, top: 16, bottom: 16, right: 28),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 24,
width: 24,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: const Color.fromRGBO(7, 177, 249, 0.4),
),
child: const Center(
child: Image(
image: AssetImage('assets/images/info.png'),
height: 9.75,
width: 2,
),
),
),
const SizedBox(
width: 12,
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
"Kenapa belajar bahasa isyarat?",
style: TextStyle(
color: Color(0xFF1D2939),
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 4,
),
Text(
"Karena dapat membantu seseorang terhubung dengan orang-orang yang tuli, meningkatkan empati dan keterbukaan",
style: TextStyle(
color: Color(0xFF475467),
fontSize: 12,
),
),
],
),
),
],
),
),
),
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
border: Border.all(
color: const Color(0xFFEAECF0),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.02),
blurRadius: 16,
offset: Offset(0, 8),
),
]),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFF4D2),
),
padding: const EdgeInsets.all(8),
child: Column(
children: const [
Icon(
Iconsax.text_block5,
color:
Color.fromRGBO(219, 136, 24, 0.4),
),
],
),
),
const SizedBox(
height: 16,
),
const SizedBox(
width: 100,
child: Text(
"Huruf dan Angka",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
InkWell(
onTap: () {
Navigator.of(context)
.push(_createRoute());
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFF5A21D),
border: Border.all(
color: const Color(0xFFF5A21D),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(
16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 14),
child: const Text(
"Belajar",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
),
),
Container(
height: 60,
width: 60,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(12),
),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.5, 0.5),
colors: [
Color.fromRGBO(255, 244, 210, 1),
Color.fromRGBO(255, 244, 210, 0),
],
),
),
),
],
),
),
),
const SizedBox(
width: 16,
),
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
border: Border.all(
color: const Color(0xFFEAECF0),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.02),
blurRadius: 16,
offset: Offset(0, 8),
),
]),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFF4D2),
),
padding: const EdgeInsets.all(8),
child: Column(
children: const [
Icon(
Iconsax.note5,
color:
Color.fromRGBO(219, 136, 24, 0.4),
),
],
),
),
const SizedBox(
height: 16,
),
const SizedBox(
width: 100,
child: Text(
"Kata Isyarat",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
InkWell(
onTap: () {
Navigator.of(context)
.push(_createRouteKataIsyarat());
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFF5A21D),
border: Border.all(
color: const Color(0xFFF5A21D),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(
16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 14),
child: const Text(
"Belajar",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
),
),
Container(
height: 60,
width: 60,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(12),
),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.5, 0.5),
colors: [
Color.fromRGBO(255, 244, 210, 1),
Color.fromRGBO(255, 244, 210, 0),
],
),
),
),
],
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 32),
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
border: Border.all(
color: const Color(0xFFEAECF0),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.02),
blurRadius: 16,
offset: Offset(0, 8),
),
]),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFF4D2),
),
padding: const EdgeInsets.all(8),
child: Column(
children: const [
Icon(
Iconsax.element_plus5,
color:
Color.fromRGBO(219, 136, 24, 0.4),
),
],
),
),
const SizedBox(
height: 16,
),
const SizedBox(
width: 100,
child: Text(
"Kata Imbuhan",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
InkWell(
onTap: () {
Navigator.of(context)
.push(_createRouteImbuhan());
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFF5A21D),
border: Border.all(
color: const Color(0xFFF5A21D),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(
16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 14),
child: const Text(
"Belajar",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
),
),
Container(
height: 60,
width: 60,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(12),
),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.5, 0.5),
colors: [
Color.fromRGBO(255, 244, 210, 1),
Color.fromRGBO(255, 244, 210, 0),
],
),
),
),
],
),
),
),
const SizedBox(
width: 16,
),
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
border: Border.all(
color: const Color(0xFFEAECF0),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.02),
blurRadius: 16,
offset: Offset(0, 8),
),
]),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFF4D2),
),
padding: const EdgeInsets.all(8),
child: Column(
children: const [
Icon(
Iconsax.add_circle5,
color:
Color.fromRGBO(219, 136, 24, 0.4),
),
],
),
),
const SizedBox(
height: 16,
),
const SizedBox(
width: 100,
child: Text(
"Tambah Kata",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
InkWell(
onTap: () {
Navigator.of(context)
.push(_createRouteTambahKata());
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFF5A21D),
border: Border.all(
color: const Color(0xFFF5A21D),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(
16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 14),
child: const Text(
"Belajar",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
),
),
Container(
height: 60,
width: 60,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(12),
),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.5, 0.5),
colors: [
Color.fromRGBO(255, 244, 210, 1),
Color.fromRGBO(255, 244, 210, 0),
],
),
),
),
],
),
),
),
],
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/tuna_rungu_apps/lib | mirrored_repositories/tuna_rungu_apps/lib/pages/hurufangka.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:iconsax/iconsax.dart';
import 'package:video_player/video_player.dart';
class HurufAngkaPage extends StatefulWidget {
const HurufAngkaPage({Key? key}) : super(key: key);
@override
State<HurufAngkaPage> createState() => _HurufAngkaPageState();
}
class _HurufAngkaPageState extends State<HurufAngkaPage>
with SingleTickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
_tabController = TabController(length: 2, vsync: this);
super.initState();
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5A21D),
body: SafeArea(
child: Container(
height: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
color: Colors.white,
),
padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
iconSize: 24,
padding: const EdgeInsets.all(0),
alignment: Alignment.centerLeft,
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Iconsax.arrow_left,
),
color: const Color(0xFF475467),
),
const Text(
"Kembali",
style: TextStyle(
color: Color(0xFF475467),
fontSize: 16,
),
),
],
),
const SizedBox(
height: 16,
),
const Text(
"Huruf dan Angka",
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
const SizedBox(
height: 8,
),
const Flexible(
child: Text(
"Belajar bahasa isyarat huruf dan angka dengan gambar dan video tutorial",
style: TextStyle(
color: Color(0xFF667085),
fontSize: 14,
),
),
),
const SizedBox(
height: 16,
),
Container(
height: 45,
decoration: BoxDecoration(
color: const Color(0xFFF9FAFB),
borderRadius: BorderRadius.circular(16),
),
padding: const EdgeInsets.all(4),
child: TabBar(
controller: _tabController,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.1),
blurRadius: 3,
offset: Offset(0, 1),
),
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.06),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
labelStyle: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14,
),
labelColor: const Color(0xFF344054),
unselectedLabelColor: const Color(0xFF667085),
tabs: const [
Tab(
text: 'Huruf',
),
Tab(
text: 'Angka',
),
],
),
),
const SizedBox(
height: 32,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.58,
child: TabBarView(
controller: _tabController,
children: const [
HurufContainer(),
AngkaContainer(),
],
),
),
],
),
),
),
);
}
}
class HurufContainer extends StatelessWidget {
const HurufContainer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
FirebaseFirestore db = FirebaseFirestore.instance;
CollectionReference abjad = db.collection('abjad');
return FutureBuilder<QuerySnapshot>(
future: abjad.get(),
builder: (_, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return AlignedGridView.count(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
itemCount: snapshot.data!.docs.length,
itemBuilder: (BuildContext ctx, index) {
return InkWell(
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Image(
fit: BoxFit.fill,
image: snapshot.data?.docs[index]['link'] == ""
? const AssetImage(
'assets/images/image-dummy.png')
as ImageProvider
: NetworkImage(
snapshot.data?.docs[index]['link']),
),
const SizedBox(
height: 24,
),
Text(
'Huruf ' + snapshot.data?.docs[index]['abjad'],
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const SizedBox(
height: 24,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFFFFF),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(
vertical: 8, horizontal: 14),
child: const Text(
"Keluar",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
),
),
),
child: Column(
children: [
Container(
height: 160,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
image: DecorationImage(
fit: BoxFit.fill,
image: snapshot.data?.docs[index]['link'] == ""
? const AssetImage('assets/images/image-dummy.png')
as ImageProvider
: NetworkImage(snapshot.data?.docs[index]['link']),
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.5,
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
),
child: Text(
'Huruf ' + snapshot.data?.docs[index]['abjad'],
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
],
),
);
},
);
},
);
}
}
class AngkaContainer extends StatelessWidget {
const AngkaContainer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
FirebaseFirestore db = FirebaseFirestore.instance;
CollectionReference angka = db.collection('angka');
return FutureBuilder<QuerySnapshot>(
future: angka.get(),
builder: (_, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return AlignedGridView.count(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
itemCount: snapshot.data!.docs.length,
itemBuilder: (BuildContext ctx, index) {
return InkWell(
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: VideoPop(
linkVideo: snapshot.data?.docs[index]['link'],
namaVideo: snapshot.data?.docs[index]['angka'],
),
),
),
child: Column(
children: [
Container(
height: 160,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
image: const DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
'https://firebasestorage.googleapis.com/v0/b/imk-kel-1.appspot.com/o/angka%2Fthumbnail.png?alt=media&token=ecd82839-359b-47a0-ab28-8839c755812f'),
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.5,
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
),
child: Text(
'Angka ' + snapshot.data?.docs[index]['angka'],
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
],
),
);
},
);
},
);
}
}
class VideoPop extends StatefulWidget {
final String linkVideo;
final String namaVideo;
const VideoPop({Key? key, required this.linkVideo, required this.namaVideo})
: super(key: key);
@override
State<VideoPop> createState() => _VideoPopState();
}
class _VideoPopState extends State<VideoPop> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(widget.linkVideo);
_controller.addListener(() {
setState(() {});
});
_controller.setLooping(true);
_controller.initialize();
_controller.play();
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: Stack(
children: <Widget>[
VideoPlayer(_controller),
],
),
),
const SizedBox(
height: 24,
),
Text(
widget.namaVideo,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const SizedBox(
height: 24,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFFFFF),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 14),
child: const Text(
"Keluar",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}
| 0 |
mirrored_repositories/tuna_rungu_apps/lib | mirrored_repositories/tuna_rungu_apps/lib/pages/kosakata.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:iconsax/iconsax.dart';
import 'package:video_player/video_player.dart';
class KosakataPage extends StatelessWidget {
const KosakataPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5A21D),
body: SafeArea(
child: Container(
height: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
color: Colors.white,
),
padding: const EdgeInsets.only(left: 16, right: 16, top: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
iconSize: 24,
padding: const EdgeInsets.all(0),
alignment: Alignment.centerLeft,
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Iconsax.arrow_left,
),
color: const Color(0xFF475467),
),
const Text(
"Kembali",
style: TextStyle(
color: Color(0xFF475467),
fontSize: 16,
),
),
],
),
const SizedBox(
height: 16,
),
const Text(
"Kata Isyarat",
style: TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
const SizedBox(
height: 8,
),
const Flexible(
child: Text(
"Belajar kata isyarat dengan video tutorial",
style: TextStyle(
color: Color(0xFF667085),
fontSize: 14,
),
),
),
const SizedBox(
height: 32,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.685,
child: const KosakataContainer(),
),
],
),
),
),
);
}
}
class KosakataContainer extends StatelessWidget {
const KosakataContainer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
FirebaseFirestore db = FirebaseFirestore.instance;
CollectionReference kosakata = db.collection('kosakata');
return FutureBuilder<QuerySnapshot>(
future: kosakata.get(),
builder: (_, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return AlignedGridView.count(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
itemCount: snapshot.data!.docs.length,
itemBuilder: (BuildContext ctx, index) {
return InkWell(
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: VideoPop(
linkVideo: snapshot.data?.docs[index]['link'],
namaVideo: snapshot.data?.docs[index]['kata'],
),
),
),
child: Column(
children: [
Container(
height: 160,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
image: const DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
'https://firebasestorage.googleapis.com/v0/b/imk-kel-1.appspot.com/o/kosakata%2Fthumbnail.png?alt=media&token=0583ece8-b9d3-4e23-8067-514eb8a5daeb'),
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.5,
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
),
border: Border.all(
color: const Color(0xFFEAECF0),
),
),
child: Text(
snapshot.data?.docs[index]['kata'],
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
const SizedBox(
height: 16,
),
],
),
);
},
);
},
);
}
}
class VideoPop extends StatefulWidget {
final String linkVideo;
final String namaVideo;
const VideoPop({Key? key, required this.linkVideo, required this.namaVideo})
: super(key: key);
@override
State<VideoPop> createState() => _VideoPopState();
}
class _VideoPopState extends State<VideoPop> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(widget.linkVideo);
_controller.addListener(() {
setState(() {});
});
_controller.setLooping(true);
_controller.initialize();
_controller.play();
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: Stack(
children: <Widget>[
VideoPlayer(_controller),
],
),
),
const SizedBox(
height: 24,
),
Text(
widget.namaVideo,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color(0xFF1D2939),
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
const SizedBox(
height: 24,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color(0xFFFFFFFF),
border: Border.all(
color: const Color(0xFFD0D5DD),
),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(16, 24, 40, 0.05),
blurRadius: 2,
offset: Offset(0, 1),
),
],
),
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 14),
child: const Text(
"Keluar",
style: TextStyle(
color: Color(0xFF344054),
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
],
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}
| 0 |
mirrored_repositories/tuna_rungu_apps | mirrored_repositories/tuna_rungu_apps/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:tuna_rungu_apps/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/smart-home-app | mirrored_repositories/smart-home-app/lib/main.dart | import 'package:domus/provider/getit.dart';
import 'package:domus/routes/routes.dart';
import 'package:domus/service/navigation_service.dart';
// import 'package:domus/src/screens/about_screen/about_us_screen.dart';
import 'package:domus/src/screens/splash_screen/splash_screen.dart';
import 'package:flutter/material.dart';
void main() async {
setupLocator();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
final ThemeMode themeMode = ThemeMode.system;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Domus',
navigatorKey: getIt<NavigationService>().navigatorKey,
debugShowCheckedModeBanner: false,
themeMode: themeMode,
theme: ThemeData(
fontFamily: 'Nato Sans',
textSelectionTheme: const TextSelectionThemeData(
// Set Up for TextFields
cursorColor: Colors.grey,
selectionColor: Colors.blueGrey,
),
colorScheme: const ColorScheme.light(
primary: Color(0xFFF2F2F2),
//secondary: Color(0xFFF4AE47),
surface: Color(0xFFC4C4C4),
background: Color(0xFFFFFFFF),
error: Color(0xFFB00020),
onPrimary: Colors.white,
onSecondary: Colors.white,
onSurface: Colors.black,
onBackground: Colors.black,
onError: Colors.white,
brightness: Brightness.light,
),
textTheme: const TextTheme(
headline1: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold,
fontSize: 32,
color: Color(0xFF464646),
),
headline2: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w700,
fontSize: 18,
color: Color(0xFF464646),
),
headline3: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w400,
fontSize: 18,
color: Color(0xFF464646),
),
headline4: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w400,
fontSize: 18,
color: Color(0xFFBDBDBD),
),
headline5: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w400,
fontSize: 12,
color: Color(0xFFBDBDBD),
),
headline6: TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF464646),
),
),
),
routes: routes,
home: const SplashScreen(),
);
}
}
///---------------Build Release Apk----------------///
///flutter build apk --build-name=1.0.x --build-number=x
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/smart_fan_view_model.dart | import 'dart:ui';
import 'package:domus/provider/base_model.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
class SmartFanViewModel extends BaseModel {
//--------------VARIABLES----------//
PanelController pc = PanelController();
// bool isTappedOnColor = false;
bool isFanOff = false;
final List<bool> isSelected = [true, false, false];
double speed = 2;
final List<int> duration = [10000, 1000, 800, 600, 400, 200];
///keeping track of all three factors - even index will do the task
int selectedIndex = 0;
Color lightColor = const Color(0xFF7054FF);
String fanImage = 'assets/images/fan.png';
void fanSwitch(bool value) {
isFanOff = value;
notifyListeners();
}
void onToggleTapped(int index) {
for (int i = 0; i < isSelected.length; i++) {
isSelected[i] = i == index;
}
notifyListeners();
}
void changeSpeed(newVal) {
speed = newVal;
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/smart_ac_view_model.dart | import 'package:domus/provider/base_model.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
class SmartACViewModel extends BaseModel {
//--------------VARIABLES----------//
PanelController pc = PanelController();
bool isACon = true;
final List<bool> isSelected = [true, false, false, false];
double timerHours = 8;
void acSwitch(bool value) {
isACon = value;
notifyListeners();
}
void onToggleTapped(int index) {
for (int i = 0; i < isSelected.length; i++) {
isSelected[i] = i == index;
}
notifyListeners();
}
void changeTimerHours(double newval) {
timerHours = newval;
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/smart_tv_view_model.dart | import 'package:domus/provider/base_model.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:flutter/material.dart';
import 'package:domus/src/screens/my_list_screen/my_list_screen.dart';
class SmartTvViewModel extends BaseModel {
//--------------VARIABLES----------//
PanelController pc = PanelController();
final List<bool> isSelected = [true, false, false];
double lightIntensity = 65;
bool isTvOff = false;
int selectedIndex = 0;
String lightImage = 'assets/images/tv.png';
void tvSwitch(bool value) {
isTvOff = value;
notifyListeners();
}
void onToggleTapped(int index,context) {
for (int i = 0; i < isSelected.length; i++) {
isSelected[i] = i == index;
}
notifyListeners();
if(index == 2)
{
Navigator.of(context).pushNamed(MyListScreen.routeName);
}
}
void changeTvIntensity(double newVal) {
lightIntensity = newVal;
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/smart_speaker_view_model.dart | import 'package:domus/provider/base_model.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
class SmartSpeakerViewModel extends BaseModel {
PanelController pc = PanelController();
bool isSpeakeron = true;
double speakerVolume = 65;
void speakerSwitch(bool value) {
isSpeakeron = value;
notifyListeners();
}
void changeSpeakerVolume(double newVal) {
speakerVolume = newVal;
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/smart_light_view_model.dart | import 'dart:ui';
import 'package:domus/constant/constant.dart';
import 'package:domus/provider/base_model.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
class SmartLightViewModel extends BaseModel {
//--------------VARIABLES----------//
PanelController pc = PanelController();
bool isTappedOnColor = false;
bool isLightOff = false;
final List<bool> isSelected = [true, false];
double lightIntensity = 65;
///keeping track of all three factors - even index will do the task
int selectedIndex = 0;
Color lightColor = const Color(0xFF7054FF);
String lightImage = 'assets/images/purple.png';
void showColorPanel() {
isTappedOnColor = true;
notifyListeners();
pc.open();
}
void lightSwitch(bool value) {
isLightOff = value;
notifyListeners();
}
void onPanelClosed() {
if (isTappedOnColor) {
isTappedOnColor = false;
notifyListeners();
}
}
void changeColor({required int currentIndex}) {
selectedIndex = currentIndex;
lightColor = Constants.colors[currentIndex].color;
notifyListeners();
}
void changeImage() {
lightImage = Constants.colors[selectedIndex].image;
notifyListeners();
}
void onToggleTapped(int index) {
for (int i = 0; i < isSelected.length; i++) {
isSelected[i] = i == index;
}
notifyListeners();
}
void changeLightIntensity(double newVal) {
lightIntensity = newVal;
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/view/home_screen_view_model.dart | import 'dart:math';
import 'package:domus/provider/base_model.dart';
import 'package:flutter/cupertino.dart';
class HomeScreenViewModel extends BaseModel {
//-------------VARIABLES-------------//
int selectedIndex = 0;
int randomNumber = 1;
final PageController pageController = PageController();
bool isLightOn = true;
bool isACON = false;
bool isSpeakerON = false;
bool isFanON = false;
bool isLightFav = false;
bool isACFav = false;
bool isSpeakerFav = false;
bool isFanFav = false;
void generateRandomNumber() {
randomNumber = Random().nextInt(8);
notifyListeners();
}
void lightFav(){
isLightFav = !isLightFav;
notifyListeners();
}
void acFav(){
isACFav = !isACFav;
notifyListeners();
}
void speakerFav() {
isSpeakerFav = !isSpeakerFav;
notifyListeners();
}
void fanFav() {
isFanFav = !isFanFav;
notifyListeners();
}
void acSwitch() {
isACON = !isACON;
notifyListeners();
}
void speakerSwitch() {
isSpeakerON = !isSpeakerON;
notifyListeners();
}
void fanSwitch() {
isFanON = !isFanON;
notifyListeners();
}
void lightSwitch() {
isLightOn = !isLightOn;
notifyListeners();
}
///On tapping bottom nav bar items
void onItemTapped(int index) {
selectedIndex = index;
pageController.animateToPage(index,
duration: const Duration(milliseconds: 500), curve: Curves.easeOut);
notifyListeners();
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/routes/routes.dart | import 'package:domus/src/screens/set_event_screen/set_event_screen.dart';
import 'package:domus/src/screens/edit_profile/edit_profile.dart';
import 'package:domus/src/screens/login_screen/login_screen.dart';
import 'package:domus/src/screens/settings_screen/settings_screen.dart';
import 'package:domus/src/screens/smart_ac/smart_ac.dart';
import 'package:domus/src/screens/smart_light/smart_light.dart';
import 'package:domus/src/screens/smart_speaker/smart_speaker.dart';
import 'package:domus/src/screens/smart_fan/smart_fan.dart';
import 'package:domus/src/screens/splash_screen/splash_screen.dart';
import 'package:domus/src/screens/stats_screen/stats_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:domus/src/screens/home_screen/home_screen.dart';
import 'package:domus/src/screens/my_list_screen/my_list_screen.dart';
import 'package:domus/src/screens/savings_screen/savings_screen.dart';
import 'package:domus/src/screens/smart_tv/smart_tv.dart';
// Routes arranged in ascending order
final Map<String, WidgetBuilder> routes = {
EditProfile.routeName: (context) => const EditProfile(),
HomeScreen.routeName: (context) => const HomeScreen(),
LoginScreen.routeName: (context) => const LoginScreen(),
SavingsScreen.routeName: (context) => const SavingsScreen(),
SetEventScreen.routeName: (context) => const SetEventScreen(),
SettingScreen.routeName: (context) => const SettingScreen(),
SmartAC.routeName: (context) => const SmartAC(),
SmartFan.routeName: (context) => const SmartFan(),
SmartTV.routeName: (context) => const SmartTV(),
SmartLight.routeName: (context) => const SmartLight(),
SmartSpeaker.routeName: (context) => const SmartSpeaker(),
SplashScreen.routeName: (context) => const SplashScreen(),
StatsScreen.routeName: (context) => const StatsScreen(),
MyListScreen.routeName: (context) => const MyListScreen()
};
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/config/size_config.dart | import 'package:flutter/cupertino.dart';
class SizeConfig {
static MediaQueryData? _mediaQueryData;
static double? screenWidth;
static double? screenHeight;
static double? defaultSize;
static Orientation? orientation;
void init(BuildContext context) {
_mediaQueryData = MediaQuery.of(context);
screenWidth = _mediaQueryData!.size.width;
screenHeight = _mediaQueryData!.size.height;
orientation = _mediaQueryData!.orientation;
}
}
// Get the proportionate height as per screen size
double getProportionateScreenHeight(double inputHeight) {
double screenHeight = SizeConfig.screenHeight as double;
// 812 is the layout height that designer use
return (inputHeight / 585) * screenHeight;
}
// Get the proportionate height as per screen size
double getProportionateScreenWidth(double inputWidth) {
double screenWidth = SizeConfig.screenWidth as double;
// 375 is the layout width that designer use
return (inputWidth / 270) * screenWidth;
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_warning.dart | import 'package:domus/popups/popup_state.dart';
import 'package:flutter/material.dart';
class PopupWarning extends PopupState {
const PopupWarning({
Key? key,
required String popupTitle,
String? popupSubtitle,
List<Widget>? popupActions,
}) : super(
key: key,
popupIcon: Icons.priority_high_rounded,
popupIconColor: const Color(0xFFFFD912),
popupTitle: popupTitle,
popupSubtitle: popupSubtitle,
popupActions: popupActions,
);
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_success.dart | import 'package:domus/popups/popup_state.dart';
import 'package:flutter/material.dart';
class PopupSuccess extends PopupState {
const PopupSuccess({
Key? key,
required String popupTitle,
String? popupSubtitle,
List<Widget>? popupActions,
}) : super(
key: key,
popupIcon: Icons.check_rounded,
popupIconColor: const Color(0xFF27AE60),
popupTitle: popupTitle,
popupSubtitle: popupSubtitle,
popupActions: popupActions,
);
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_state.dart | import 'package:domus/popups/popup_widgets.dart';
import 'package:flutter/material.dart';
class PopupState extends StatelessWidget {
const PopupState({
Key? key,
required this.popupIcon,
required this.popupIconColor,
required this.popupTitle,
this.popupSubtitle,
this.popupActions,
}) : super(key: key);
final IconData popupIcon;
final Color popupIconColor;
final String popupTitle;
final String? popupSubtitle;
final List<Widget>? popupActions;
@override
Widget build(BuildContext context) {
return PopupAlertDialog(
popupTopWidget: PopupIcon(
icon: popupIcon,
iconColor: popupIconColor,
),
popupContent: PopupListTile(
popupTitle: popupTitle,
popupSubtitle: popupSubtitle,
),
popupActions: popupActions,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_form.dart | import 'package:domus/popups/popup_widgets.dart';
import 'package:flutter/material.dart';
class PopupForm extends StatelessWidget {
const PopupForm({
Key? key,
required this.popupTitle,
this.popupSubtitle,
required this.popupFormContent,
this.popupFormActions,
}) : super(key: key);
final String popupTitle;
final String? popupSubtitle;
final List<Widget> popupFormContent;
final List<Widget>? popupFormActions;
@override
Widget build(BuildContext context) {
return PopupAlertDialog(
popupTopWidget: PopupListTile(
popupTitle: popupTitle,
popupSubtitle: popupSubtitle,
),
popupContent: Form(
child: Column(
mainAxisSize: MainAxisSize.min,
children: popupFormContent,
),
),
popupActions: popupFormActions,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_error.dart | import 'package:domus/popups/popup_state.dart';
import 'package:flutter/material.dart';
class PopupError extends PopupState {
const PopupError({
Key? key,
required String popupTitle,
String? popupSubtitle,
List<Widget>? popupActions,
}) : super(
key: key,
popupIcon: Icons.close_rounded,
popupIconColor: const Color(0xFFDB524E),
popupTitle: popupTitle,
popupSubtitle: popupSubtitle,
popupActions: popupActions,
);
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/popups/popup_widgets.dart | export 'popup_widgets/popup_alert_dialog.dart';
export 'popup_widgets/popup_filled_button.dart';
export 'popup_widgets/popup_form_field.dart';
export 'popup_widgets/popup_icon.dart';
export 'popup_widgets/popup_list_tile.dart';
export 'popup_widgets/popup_outlined_button.dart';
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_form_field.dart | import 'package:flutter/material.dart';
class PopupFormField extends StatelessWidget {
const PopupFormField({
Key? key,
this.textController,
this.popupIcon,
required this.popupHintText,
this.onTap,
}) : super(key: key);
final TextEditingController? textController;
final Widget? popupIcon;
final String popupHintText;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
return Card(
elevation: 1.5,
child: Padding(
padding: const EdgeInsets.only(left: 11),
child: TextFormField(
autofocus: true,
textCapitalization: TextCapitalization.words,
controller: textController,
decoration: InputDecoration(
border: InputBorder.none,
icon: popupIcon,
hintText: popupHintText,
),
onTap: onTap,
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_list_tile.dart | import 'package:flutter/material.dart';
class PopupListTile extends StatelessWidget {
const PopupListTile({
Key? key,
required this.popupTitle,
this.popupSubtitle,
}) : super(key: key);
final String popupTitle;
final String? popupSubtitle;
// Judges whether the SubTitle is given, and acts accordingly
Widget? _judgeSubtitle() {
return popupSubtitle == null
? null
: Text(
popupSubtitle!,
textAlign: TextAlign.center,
);
}
@override
Widget build(BuildContext context) {
return ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text(
popupTitle,
style: const TextStyle(
fontFamily: 'Lexend',
fontSize: 20,
),
textAlign: TextAlign.center,
),
),
subtitle: _judgeSubtitle(),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_filled_button.dart | import 'package:flutter/material.dart';
class PopupFilledButton extends StatelessWidget {
const PopupFilledButton({
Key? key,
required this.onPressed,
required this.text,
}) : super(key: key);
final VoidCallback onPressed;
final String text;
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: onPressed,
child: Text(
text,
style: const TextStyle(color: Colors.white),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(const Color(0xFF464646)),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_alert_dialog.dart | import 'package:flutter/material.dart';
class PopupAlertDialog extends StatelessWidget {
const PopupAlertDialog({
Key? key,
required this.popupTopWidget,
required this.popupContent,
this.popupActions,
}) : super(key: key);
final Widget popupTopWidget;
final Widget popupContent;
final List<Widget>? popupActions;
@override
Widget build(BuildContext context) {
return AlertDialog(
title: popupTopWidget,
content: popupContent,
actionsAlignment: MainAxisAlignment.center,
actions: popupActions,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_outlined_button.dart | import 'package:flutter/material.dart';
class PopupOutlinedButton extends StatelessWidget {
const PopupOutlinedButton({
Key? key,
required this.onPressed,
required this.text,
}) : super(key: key);
final VoidCallback onPressed;
final String text;
@override
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: onPressed,
child: Text(
text,
style: const TextStyle(color: Color(0xFF464646)),
),
style: ButtonStyle(
side: MaterialStateProperty.all(
const BorderSide(
color: Color(0xFF464646),
width: 1.5,
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/popups | mirrored_repositories/smart-home-app/lib/popups/popup_widgets/popup_icon.dart | import 'package:flutter/material.dart';
class PopupIcon extends StatelessWidget {
const PopupIcon({
Key? key,
required this.icon,
required this.iconColor,
}) : super(key: key);
final IconData icon;
final Color iconColor;
@override
Widget build(BuildContext context) {
return Stack(
alignment: AlignmentDirectional.center,
children: [
Icon(
Icons.circle_rounded,
color: iconColor.withOpacity(0.12),
size: 80,
),
Icon(
icon,
color: iconColor,
size: 40,
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib | mirrored_repositories/smart-home-app/lib/service/navigation_service.dart | import 'package:flutter/material.dart';
class NavigationService {
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
Future navigateTo(String routeName,
{Object? arguments, bool withreplacement = false}) {
if (withreplacement) {
return navigatorKey.currentState!.pushNamedAndRemoveUntil(
routeName, (route) => false,
arguments: arguments);
} else {
return navigatorKey.currentState!
.pushNamed(routeName, arguments: arguments);
}
}
bool pop({required String routeName, Object? argument}) {
navigatorKey.currentState!.pop();
return true;
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src | mirrored_repositories/smart-home-app/lib/src/widgets/custom_bottom_nav_bar.dart | import 'package:domus/view/home_screen_view_model.dart';
import 'package:flutter/material.dart';
class CustomBottomNavBar extends StatelessWidget {
const CustomBottomNavBar({
Key? key,
required this.model,
}) : super(key: key);
final HomeScreenViewModel model;
@override
Widget build(BuildContext context) {
return BottomNavigationBar(
currentIndex: model.selectedIndex,
selectedItemColor: Colors.black,
elevation: 0,
onTap: model.onItemTapped,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
label: '',
icon: Icon(Icons.home),
backgroundColor: Colors.white,
),
BottomNavigationBarItem(
label: '',
icon: Icon(Icons.auto_graph_rounded),
backgroundColor: Colors.lightBlue,
),
BottomNavigationBarItem(
label: '',
icon: Icon(Icons.history),
backgroundColor: Colors.lightBlue,
),
BottomNavigationBarItem(
label: '',
icon: Icon(Icons.person_rounded),
backgroundColor: Colors.lightBlue,
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src | mirrored_repositories/smart-home-app/lib/src/models/color_model.dart | import 'dart:ui';
class ColorModel {
final int index;
final Color color;
final String image;
ColorModel({
required this.index,
required this.color,
required this.image,
});
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/smart_fan/smart_fan.dart | import 'package:domus/provider/base_view.dart';
import 'package:domus/src/screens/smart_fan/components/expandable_bottom_sheet.dart';
import 'package:domus/view/smart_fan_view_model.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'components/body.dart';
class SmartFan extends StatelessWidget {
static String routeName = '/smart-fan';
const SmartFan({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<SmartFanViewModel>(
onModelReady: (model) => {},
builder: (context, model, child) {
return Material(
child: SlidingUpPanel(
controller: model.pc,
backdropEnabled: true,
boxShadow: const [],
body: Scaffold(
backgroundColor: const Color(0xFFF2F2F2),
body: Body(
model: model,
),
),
panel: ExpandableBottomSheet(model: model),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_fan | mirrored_repositories/smart-home-app/lib/src/screens/smart_fan/components/expandable_bottom_sheet.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_fan_view_model.dart';
import 'package:flutter/material.dart';
class ExpandableBottomSheet extends StatelessWidget {
const ExpandableBottomSheet({Key? key, required this.model})
: super(key: key);
final SmartFanViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Schedule',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Set schedule room fan',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: true,
onChanged: (value) {},
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Timer',
style: Theme.of(context).textTheme.headline2,
),
Text(
'time',
style: Theme.of(context).textTheme.headline2,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'2H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'4H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'6H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'8H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'10H',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_fan | mirrored_repositories/smart-home-app/lib/src/screens/smart_fan/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_fan_view_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class Body extends StatefulWidget {
const Body({Key? key, required this.model}) : super(key: key);
final SmartFanViewModel model;
@override
_BodyState createState() => _BodyState();
}
class _BodyState extends State<Body> with TickerProviderStateMixin {
late final AnimationController _controller;
late final AnimationController _noController;
int getDuration(double speed) {
if (widget.model.speed == 0) return widget.model.duration[0].toInt();
if (widget.model.speed > 0 && widget.model.speed <= 1) {
return widget.model.duration[1].toInt();
}
if (widget.model.speed > 1 && widget.model.speed <= 2) {
return widget.model.duration[2].toInt();
}
if (widget.model.speed > 2 && widget.model.speed <= 3) {
return widget.model.duration[3].toInt();
}
if (widget.model.speed > 3 && widget.model.speed <= 4) {
return widget.model.duration[4].toInt();
}
if (widget.model.speed > 4 && widget.model.speed <= 5) {
return widget.model.duration[5].toInt();
} else {
return 0;
}
}
@override
void initState() {
super.initState();
_noController = AnimationController(
vsync: this,
duration: const Duration(seconds: 1000),
)..repeat();
if (kDebugMode) {
print(widget.model.speed);
}
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: getDuration(widget.model.speed)),
)..repeat();
}
void changespeed(AnimationController c) {
c.duration = Duration(milliseconds: getDuration(widget.model.speed));
if (c.isAnimating) c.forward();
c.repeat();
}
@override
void dispose() {
_noController.dispose();
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(15),
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined)),
Stack(
children: [
Text(
'Living\nRoom',
style: Theme.of(context)
.textTheme
.headline1!
.copyWith(
fontSize: 45,
color: const Color(0xFFBDBDBD)
.withOpacity(0.5),
),
),
Text(
'Smart\nFan',
style: Theme.of(context).textTheme.headline1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(26),
),
Text(
'Power',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(4),
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: widget.model.isFanOff,
onChanged: (value) {
widget.model.fanSwitch(value);
},
),
SizedBox(
height: getProportionateScreenHeight(20),
),
SizedBox(
height: getProportionateScreenHeight(10),
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(105),
),
],
),
),
// SizedBox(width: 10,),
Column(
children: [
const SizedBox(
height: 20,
),
Container(
height: getProportionateScreenHeight(260),
width: getProportionateScreenWidth(120),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
),
child: Lottie.asset(
'assets/Lottie/fan.json',
// width: 260,
// height: 250,
fit: BoxFit.fill,
animate: widget.model.isFanOff ? true : false,
controller:
widget.model.isFanOff ? _controller : _noController,
),
)
],
),
const Padding(
padding: EdgeInsets.only(
right: 10,
)),
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
15,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Mode',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(9),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: ToggleButtons(
selectedColor: Colors.white,
fillColor: const Color(0xFF464646),
renderBorder: false,
borderRadius: BorderRadius.circular(15),
textStyle: Theme.of(context)
.textTheme
.headline2!
.copyWith(color: Colors.white),
children: <Widget>[
SizedBox(
width: getProportionateScreenWidth(76),
child: const Text(
'Air',
textAlign: TextAlign.center,
),
),
SizedBox(
width: getProportionateScreenWidth(76),
child: const Text(
'Mild',
textAlign: TextAlign.center,
),
),
SizedBox(
width: getProportionateScreenWidth(76),
child: const Text(
'Breeze',
textAlign: TextAlign.center,
),
),
],
onPressed: (int index) {
widget.model.onToggleTapped(index);
},
isSelected: widget.model.isSelected,
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Speed',
style: Theme.of(context).textTheme.headline2,
),
Text(
'${widget.model.speed.toInt()}',
style: Theme.of(context).textTheme.headline2,
),
],
),
SliderTheme(
data: SliderThemeData(
trackHeight: getProportionateScreenHeight(5),
thumbColor: const Color(0xFF464646),
activeTrackColor: const Color(0xFF464646),
inactiveTrackColor: Colors.white,
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8)),
child: Slider(
min: 0,
max: 5,
onChanged: (val) {
changespeed(_controller);
widget.model.changeSpeed(val);
},
value: widget.model.speed,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Off',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'100%',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
],
),
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/stats_screen.dart | import 'package:domus/src/screens/stats_screen/components.dart';
import 'package:flutter/material.dart';
class StatsScreen extends StatelessWidget {
const StatsScreen({Key? key}) : super(key: key);
static String routeName = '/stats-screen';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.grey[100],
title: const Padding(
padding: EdgeInsets.only(top: 20, left: 15),
child: Text(
'Stats',
style: TextStyle(
fontFamily: 'Lexend',
fontSize: 36,
fontWeight: FontWeight.w500,
color: Colors.black,
),
),
),
actions: const [
Padding(
padding: EdgeInsets.only(top: 20, right: 15),
child: Icon(
Icons.bolt,
size: 36,
color: Colors.black,
),
),
],
elevation: 0,
),
body: Column(
children: const [
TypeSelection(),
SizedBox(height: 15),
Expanded(
child: StatsElectricityUsageChart(),
),
SizedBox(height: 15),
Expanded(
child: StatsDeviceConsumptionChart(),
),
SizedBox(height: 15),
],
),
bottomNavigationBar: const StatsBottomAppBar(),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components.dart | export 'components/stats_electricity_usage_chart.dart';
export 'components/stats_bottom_app_bar.dart';
export 'components/stats_device_consumption_chart.dart';
export 'components/stats_chart.dart';
export 'components/consumption.dart';
export 'components/type_selection.dart';
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/stats_chart.dart | import 'package:domus/src/screens/stats_screen/components.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
class StatsChart extends StatelessWidget {
const StatsChart({
Key? key,
required this.title,
this.subtitle,
this.trailing,
required this.plotOffset,
required this.content,
this.paddingBelow,
}) : super(key: key);
final String title;
final Widget? subtitle;
final Widget? trailing;
final double plotOffset;
final XyDataSeries<Consumption, String> content;
final double? paddingBelow;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: Colors.transparent,
),
borderRadius: BorderRadius.circular(20),
),
clipBehavior: Clip.antiAlias,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Text(
title,
style: const TextStyle(
fontFamily: 'ABeeZee',
),
),
subtitle: subtitle,
trailing: trailing,
),
Expanded(
child: SfCartesianChart(
// Plots the graph
margin: const EdgeInsets.all(0),
plotAreaBorderWidth: 0,
primaryXAxis: CategoryAxis(
plotOffset: plotOffset,
isVisible: false,
),
primaryYAxis: NumericAxis(
isVisible: false,
),
series: <XyDataSeries<Consumption, String>>[
content,
],
tooltipBehavior: TooltipBehavior(
enable: true,
header: '',
canShowMarker: false,
format: 'point.x : point.y kWh',
textStyle: const TextStyle(
fontFamily: 'ABeeZee',
),
),
),
),
SizedBox(height: paddingBelow),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/stats_device_consumption_chart.dart | import 'package:domus/src/screens/stats_screen/components.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
class StatsDeviceConsumptionChart extends StatelessWidget {
const StatsDeviceConsumptionChart({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return StatsChart(
title: 'Consumption by device',
subtitle: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: const [
Icon(
Icons.warning,
size: 18,
),
SizedBox(width: 5),
Text('Check level 240'),
],
),
plotOffset: -40,
content: ColumnSeries<Consumption, String>(
// Plots Columns / Bar chart
dataLabelSettings: const DataLabelSettings(
angle: -90,
labelAlignment: ChartDataLabelAlignment.bottom,
isVisible: true,
),
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: const Color(0xFFDCDEDF),
dataSource: const [
Consumption(day: 'First', usage: 20),
Consumption(day: 'Mon', usage: 22),
Consumption(day: 'Tue', usage: 30),
Consumption(day: 'Wed', usage: 36),
Consumption(day: 'Thur', usage: 19),
Consumption(day: 'Fri', usage: 25),
Consumption(day: 'Sat', usage: 20),
Consumption(day: 'Sun', usage: 33),
Consumption(day: 'Last', usage: 20),
],
xValueMapper: (consumption, _) => consumption.day,
yValueMapper: (consumption, _) => consumption.usage,
selectionBehavior: SelectionBehavior(
enable: true,
selectedColor: const Color(0xFFFF5722),
selectedOpacity: 0.6,
unselectedOpacity: 1,
),
),
paddingBelow: 10,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/consumption.dart | // Class for defining various types of consumptions
class Consumption {
const Consumption({
required this.day,
required this.usage,
});
final String day;
final double usage;
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/stats_bottom_app_bar.dart | import 'package:flutter/material.dart';
class StatsBottomAppBar extends StatelessWidget {
const StatsBottomAppBar({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BottomAppBar(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.share_rounded),
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.bolt_rounded),
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.bar_chart_rounded),
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.person_rounded),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/stats_electricity_usage_chart.dart | import 'package:domus/src/screens/stats_screen/components.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
class StatsElectricityUsageChart extends StatelessWidget {
const StatsElectricityUsageChart({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return StatsChart(
title: 'Daily',
subtitle: const Text(
'Electricity Usage',
style: TextStyle(
fontFamily: 'ABeeZee',
),
),
trailing: const Text(
'128',
style: TextStyle(
fontFamily: 'ABeeZee',
),
),
plotOffset: -35,
content: SplineAreaSeries<Consumption, String>(
// Plots Spline curves for smooth transitions
borderColor: const Color(0xFF464646),
borderWidth: 1,
color: const Color(0xFFD3D3D3),
dataSource: const [
Consumption(day: 'First', usage: 125),
Consumption(day: 'Mon', usage: 122),
Consumption(day: 'Tue', usage: 130),
Consumption(day: 'Wed', usage: 136),
Consumption(day: 'Thur', usage: 119),
Consumption(day: 'Fri', usage: 125),
Consumption(day: 'Sat', usage: 120),
Consumption(day: 'Sun', usage: 133),
Consumption(day: 'Last', usage: 125),
],
xValueMapper: (consumption, _) => consumption.day,
yValueMapper: (consumption, _) => consumption.usage,
markerSettings: const MarkerSettings(
color: Color(0xFF464646),
borderWidth: 1,
borderColor: Colors.white,
isVisible: true,
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/stats_screen | mirrored_repositories/smart-home-app/lib/src/screens/stats_screen/components/type_selection.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class TypeSelection extends StatefulWidget {
const TypeSelection({Key? key}) : super(key: key);
@override
State<TypeSelection> createState() => _TypeSelectionState();
}
class _TypeSelectionState extends State<TypeSelection> {
final List<bool> isSelected = [false, true, false];
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(
top: 20,
left: 20,
right: 20,
),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.horizontal(
left: Radius.circular(18),
right: Radius.circular(18),
),
),
child: ToggleButtons(
selectedColor: Colors.white,
fillColor: const Color(0xFF464646),
renderBorder: false,
borderRadius: const BorderRadius.horizontal(
left: Radius.circular(18),
right: Radius.circular(18),
),
textStyle: const TextStyle(
fontFamily: 'ABeeZee',
),
isSelected: isSelected,
children: [
SizedBox(
width: getProportionateScreenWidth(78),
child: const Text(
'Weekly',
textAlign: TextAlign.center,
),
),
SizedBox(
width: getProportionateScreenWidth(78),
child: const Text(
'Daily',
textAlign: TextAlign.center,
),
),
SizedBox(
width: getProportionateScreenWidth(78),
child: const Text(
'Monthly',
textAlign: TextAlign.center,
),
),
],
onPressed: (index) => setState(() {
for (int i = 0; i < isSelected.length; i++) {
isSelected[i] = i == index;
}
}),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/settings_screen/settings_screen.dart | import 'package:flutter/material.dart';
import 'components/body.dart';
class SettingScreen extends StatelessWidget {
static String routeName = '/settings_screen';
const SettingScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
color: const Color.fromRGBO(250, 250, 250, 1),
child: ListView(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(32, 64, 48, 20),
child: Row(
children: const [
Text(
"Settings",
style: TextStyle(
fontFamily: 'Lexend',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 0, 0, 1),
fontSize: 36,
letterSpacing: -0.3199999928474426,
height: 0.5833333333333334),
),
SizedBox(width: 102),
Icon(
Icons.close_sharp,
color: Colors.black,
size: 30,
)
],
),
),
const SettingTile(),
const SwitchTiles(),
const SizedBox(
height: 24.44,
),
const SettingTile(),
],
));
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/settings_screen | mirrored_repositories/smart-home-app/lib/src/screens/settings_screen/components/body.dart | import 'package:flutter/material.dart';
class SwitchTiles extends StatefulWidget {
const SwitchTiles({Key? key}) : super(key: key);
@override
State<SwitchTiles> createState() => _SwitchTilesState();
}
class _SwitchTilesState extends State<SwitchTiles> {
@override
Widget build(BuildContext context) {
const bool givenValue = false;
return Padding(
padding: const EdgeInsets.fromLTRB(30, 24.44, 19, 0),
child: Container(
height: 182.56,
width: 326,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
color:const Color.fromRGBO(241, 241, 241, 1),
),
child: ListView(
children: [
SwitchListTile(
activeTrackColor:const Color.fromRGBO(61, 213, 152, 1),
inactiveTrackColor:const Color.fromRGBO(210, 210, 210, 1),
activeColor: const Color.fromRGBO(70, 70, 70, 1),
inactiveThumbColor:const Color.fromRGBO(70, 70, 70, 1),
value: givenValue,
secondary: Image.asset('assets/images/settings/star.png'),
title: const Text("Option 1", style: TextStyle(fontFamily: 'Abeezee')),
onChanged: (givenValue) {
setState(() {
givenValue = true;
});
},
),
SwitchListTile(
selected: true,
activeTrackColor:const Color.fromRGBO(61, 213, 152, 1),
inactiveTrackColor:const Color.fromRGBO(210, 210, 210, 1),
activeColor:const Color.fromRGBO(70, 70, 70, 1),
inactiveThumbColor:const Color.fromRGBO(70, 70, 70, 1),
value: givenValue,
secondary: Image.asset('assets/images/settings/chat.png'),
title: const Text("Option 2", style: TextStyle(fontFamily: 'Abeezee')),
onChanged: (givenValue) {
setState(() {
givenValue = true;
});
},
),
SwitchListTile(
activeTrackColor: const Color.fromRGBO(61, 213, 152, 1),
inactiveTrackColor: const Color.fromRGBO(210, 210, 210, 1),
activeColor:const Color.fromRGBO(70, 70, 70, 1),
inactiveThumbColor:const Color.fromRGBO(70, 70, 70, 1),
value: givenValue,
secondary: Image.asset('assets/images/settings/bell.png'),
title:const Text("Option 3", style: TextStyle(fontFamily: 'Abeezee')),
onChanged: (givenValue) {
setState(() {
givenValue = true;
});
},
),
],
),
),
);
}
}
class SettingTile extends StatelessWidget {
const SettingTile({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(30, 0, 19, 0),
child: Container(
height: 182.56,
width: 326,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
color:const Color.fromRGBO(241, 241, 241, 1),
),
child: ListView(
children: [
InkWell(
onTap: () {},
child: ListTile(
leading: Image.asset('assets/images/settings/heart.png'),
title: const Text(
"Option 1",
style: TextStyle(fontFamily: 'Abeezee'),
),
trailing:const Icon(Icons.navigate_next)),
),
InkWell(
onTap: () {},
child: ListTile(
leading: Image.asset('assets/images/settings/bookmark.png'),
title:
const Text("Option 2", style: TextStyle(fontFamily: 'Abeezee')),
trailing:const Icon(Icons.navigate_next)),
),
InkWell(
onTap: () {},
child: ListTile(
leading: Image.asset('assets/images/settings/home.png'),
title:
const Text("Option 3", style: TextStyle(fontFamily: 'Abeezee')),
trailing:const Icon(Icons.navigate_next)),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen/favourites_screen.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/favourites_screen/components/favourites_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:domus/view/home_screen_view_model.dart';
class Favourites extends StatefulWidget {
final HomeScreenViewModel model;
const Favourites({Key? key, required this.model}) : super(key: key);
@override
_FavouritesState createState() => _FavouritesState();
}
class _FavouritesState extends State<Favourites> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
toolbarHeight: getProportionateScreenHeight(90),
elevation: 0,
iconTheme: const IconThemeData(color: Colors.black),
title: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
4,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Favourites',
style: Theme.of(context).textTheme.headline1,
),
Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Color(0xffdadada),
borderRadius:
BorderRadius.all(Radius.elliptical(45, 45)),
),
child: IconButton(
splashRadius: 25,
icon: const Icon(
CupertinoIcons.heart_fill,
color: Colors.grey,
size: 30
),
onPressed: () {
// Navigator.of(context).pushNamed(EditProfile.routeName);
// Navigator.push(context, MaterialPageRoute(builder: (context) => const EditProfile(),));
},
),
),
],
),
),
),
// body: Body(),
body: FavouriteList(model: widget.model),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen | mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen/components/favourite_tile.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class FavouriteTile extends StatelessWidget {
final String iconAsset;
final VoidCallback onTap;
final String device;
final String deviceCount;
final bool itsOn;
final VoidCallback switchButton;
final bool isFav;
final VoidCallback switchFav;
const FavouriteTile({
Key? key,
required this.iconAsset,
required this.onTap,
required this.device,
required this.deviceCount,
required this.itsOn,
required this.switchButton,
required this.isFav,
required this.switchFav,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
elevation: 15,
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: Container(
padding: const EdgeInsets.only(top: 20),
width: 200,
// margin: EdgeInsets.only(bottom: 10),
height: MediaQuery.of(context).size.height / 5,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: const Color(0xffededed),
// color: itsOn? const Color.fromRGBO(0, 0, 0, 1)
// ? const Color.fromRGBO(0, 0, 0, 1)
// ? Colors.white
// : const Color(0xffededed)
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
// vertical: getProportionateScreenHeight(6),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Color(0xffdadada),
// color: itsOn
// ? const Color.fromRGBO(45, 45, 45, 1)
// :
borderRadius: BorderRadius.all(Radius.elliptical(45, 45)),
),
child: SvgPicture.asset(
iconAsset,
color:const Color(0xFF808080) ,
// color: itsOn ? Colors.amber : ,
),
),
SizedBox(
width: getProportionateScreenWidth(10),
),
Text(
device,
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline2!.copyWith(
color: Colors.black,
// color: itsOn ? Colors.white : Colors.black,
),
),
SizedBox(
width: getProportionateScreenWidth(100),
),
GestureDetector(
child: Container(
width: 48,
height: 25.6,
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey,
// color:const Color(0xffd6d6d6),
// color: itsOn ? Colors.black : ,
border: Border.all(
color:Colors.grey,
// color: const Color.fromRGBO(255, 255, 255, 1),
width: itsOn ? 2 : 0,
),
),
child: Row(
children: [
itsOn ? const Spacer() : const SizedBox(),
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50),
),
),
],
),
),
onTap: switchButton,
),
const SizedBox(width: 15,)
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 15,),
Text(
deviceCount,
textAlign: TextAlign.left,
style: const TextStyle(
color: Color.fromRGBO(166, 166, 166, 1),
fontSize: 13,
letterSpacing: 0,
fontWeight: FontWeight.normal,
height: 1.6),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
itsOn ? 'On' : 'Off',
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline2!.copyWith(
color: Colors.black,
// color: itsOn ? Colors.white : Colors.black,
),
),
SizedBox(
width: getProportionateScreenWidth(160),
),
Container(
padding: const EdgeInsets.all(2),
height: 25,
width: 70,
decoration: BoxDecoration(
color:Colors.grey.shade300 ,
borderRadius: BorderRadius.circular(10),
),
child: Center(
child: Text("Kitchen",
style: TextStyle(
color:Colors.grey.shade700,
),
),
),
)
],
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen | mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class Body extends StatefulWidget {
const Body({Key? key}) : super(key: key);
@override
_BodyState createState() => _BodyState();
}
class _BodyState extends State<Body> {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.only(left: 10,right: 10),
width: MediaQuery.of(context).size.width,
// height: getProportionateScreenHeight(80),
// decoration: BoxDecoration(
// color: Colors.yellow,
// image: DecorationImage(
// image: AssetImage("assets/images/favourite.png"),
// ),
// ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height:getProportionateScreenHeight(65) ,),
Container(
height: getProportionateScreenHeight(170),
decoration: const BoxDecoration(
image:DecorationImage(
image: AssetImage("assets/images/favourite.png"),
),
),),
SizedBox(
height: getProportionateScreenHeight(20),
),
const Text(
"You haven't added anything yet",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: getProportionateScreenHeight(2),
),
const Text(
"to favourites",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: getProportionateScreenHeight(10),
),
Container(
height: getProportionateScreenHeight(43),
width: getProportionateScreenWidth(230),
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(20),
),
child: GestureDetector(
onTap: (){
Navigator.pop(context);
},
child: const Center(
child: Text('Add to favourites',
style: TextStyle(
fontSize: 19,
color: Colors.white,
fontWeight: FontWeight.bold
),)
),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen | mirrored_repositories/smart-home-app/lib/src/screens/favourites_screen/components/favourites_list.dart | import 'package:domus/src/screens/favourites_screen/components/favourite_tile.dart';
import 'package:domus/src/screens/smart_ac/smart_ac.dart';
import 'package:domus/src/screens/smart_fan/smart_fan.dart';
import 'package:domus/src/screens/smart_light/smart_light.dart';
import 'package:domus/src/screens/smart_speaker/smart_speaker.dart';
import 'package:flutter/material.dart';
import 'package:domus/view/home_screen_view_model.dart';
import 'package:domus/src/screens/favourites_screen/components/body.dart';
class FavouriteList extends StatefulWidget {
const FavouriteList({Key? key, required this.model}) : super(key: key);
final HomeScreenViewModel model;
@override
_FavouriteListState createState() => _FavouriteListState();
}
class _FavouriteListState extends State<FavouriteList> {
List<FavouriteTile> favs =<FavouriteTile>[];
@override
void initState() {
// TODO: implement initState
super.initState();
formList();
}
formList()
{
favs.clear();
if(widget.model.isLightFav) {
favs.add(
FavouriteTile(
itsOn: widget.model.isLightOn,
switchFav: widget.model.lightFav,
switchButton: widget.model.lightSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartLight.routeName);
},
iconAsset: 'assets/icons/svg/speaker.svg',
device: 'Light',
deviceCount: '1 device',
isFav: widget.model.isSpeakerFav,
),);
}
if(widget.model.isFanFav) {
favs.add( FavouriteTile(
itsOn: widget.model.isFanON,
switchButton: widget.model.fanSwitch,
switchFav: widget.model.fanFav,
onTap: () {
Navigator.of(context).pushNamed(SmartFan.routeName);
},
iconAsset: 'assets/icons/svg/fan.svg',
device: 'Fan',
deviceCount: '2 devices',
isFav: widget.model.isFanFav,
),
);
}
if(widget.model.isACFav)
{
favs.add(
FavouriteTile(
itsOn: widget.model.isACON,
switchButton: widget.model.acSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartAC.routeName);
},
iconAsset: 'assets/icons/svg/ac.svg',
device: 'AC',
deviceCount: '4 devices',
isFav: widget.model.isACFav,
switchFav: widget.model.acFav,
),
);
}
if(widget.model.isSpeakerFav)
{
favs.add(
FavouriteTile(
itsOn: widget.model.isSpeakerON,
switchButton: widget.model.speakerSwitch,
switchFav: widget.model.speakerFav,
onTap: () {
Navigator.of(context).pushNamed(SmartSpeaker.routeName);
},
iconAsset: 'assets/icons/svg/speaker.svg',
device: 'Speaker',
deviceCount: '1 device',
isFav: widget.model.isSpeakerFav,
),
);
}
}
@override
Widget build(BuildContext context) {
return favs.isEmpty? const Body() : Container(
color: Colors.white,
padding: const EdgeInsets.all(10),
child: ListView.builder(
itemCount: favs.length,
shrinkWrap: true,
itemBuilder: (context,index){
return Container(
padding: const EdgeInsets.only(bottom: 10),
child: favs[index]
);
},
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/smart_ac/smart_ac.dart | import 'package:domus/provider/base_view.dart';
import 'package:domus/src/screens/smart_ac/components/expandable_bottom_sheet.dart';
import 'package:domus/view/smart_ac_view_model.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'components/body.dart';
class SmartAC extends StatelessWidget {
static String routeName = '/smart-ac';
const SmartAC({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<SmartACViewModel>(
onModelReady: (model) => {},
builder: (context, model, child) {
return Material(
child: SlidingUpPanel(
controller: model.pc,
backdropEnabled: true,
boxShadow: const [],
body: Scaffold(
backgroundColor: const Color(0xFFF2F2F2),
body: Body(
model: model,
),
),
panel: ExpandableBottomSheet(model: model),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_ac | mirrored_repositories/smart-home-app/lib/src/screens/smart_ac/components/expandable_bottom_sheet.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_ac_view_model.dart';
import 'package:flutter/material.dart';
class ExpandableBottomSheet extends StatelessWidget {
const ExpandableBottomSheet({Key? key, required this.model})
: super(key: key);
final SmartACViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Schedule',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Set schedule room ac',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: true,
onChanged: (value) {},
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Timer',
style: Theme.of(context).textTheme.headline2,
),
Text(
'${model.timerHours.toInt()}H',
style: Theme.of(context).textTheme.headline2,
),
],
),
SliderTheme(
data: SliderThemeData(
trackHeight: getProportionateScreenHeight(5),
thumbColor: const Color(0xFF464646),
activeTrackColor: const Color(0xFF464646),
inactiveTrackColor: const Color(0xFFC4C4C4),
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8)),
child: Slider(
min: 1,
max: 10,
onChanged: (val) {
model.changeTimerHours(val);
},
value: model.timerHours,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'2H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'4H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'6H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'8H',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'10H',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_ac | mirrored_repositories/smart-home-app/lib/src/screens/smart_ac/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_ac_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:sleek_circular_slider/sleek_circular_slider.dart';
class Body extends StatelessWidget {
final SmartACViewModel model;
const Body({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(19),
top: getProportionateScreenHeight(5),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined)),
Stack(
children: [
Text(
'Air\nConditioner',
style: Theme.of(context).textTheme.headline1!.copyWith(
fontSize: 45,
color: const Color(0xFFBDBDBD).withOpacity(0.5),
),
),
Text(
'Living\nRoom',
style: Theme.of(context).textTheme.headline1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(30),
),
],
),
),
Align(
alignment: Alignment.center,
child: SleekCircularSlider(
min: 5,
max: 40,
initialValue: 23,
appearance: CircularSliderAppearance(
size: 200,
startAngle: 250,
angleRange: 360,
customColors: CustomSliderColors(
trackColor: const Color(0xFFBDBDBD),
progressBarColor: const Color(0xFF464646),
// hideShadow: true,
shadowColor: const Color(0xFFBDBDBD).withOpacity(0.1),
shadowMaxOpacity: 1,
shadowStep: 25,
),
customWidths: CustomSliderWidths(
progressBarWidth: 22,
handlerSize: 25,
trackWidth: 22,
shadowWidth: 50,
),
),
onChange: (double value) {
// callback providing a value while its being changed (with a pan gesture)
},
onChangeStart: (double startValue) {
// callback providing a starting value (when a pan gesture starts)
},
onChangeEnd: (double endValue) {
// ucallback providing an ending value (when a pan gesture ends)
},
innerWidget: (double value) {
return Padding(
padding: EdgeInsets.only(
left: getProportionateScreenHeight(12),
top: getProportionateScreenHeight(45),
),
child: Column(
children: [
Text(
'${value.toInt()}°',
style: Theme.of(context).textTheme.headline1,
),
Text(
'Celcius',
style: Theme.of(context).textTheme.headline3,
),
],
),
);
},
),
),
SizedBox(
height: getProportionateScreenHeight(30),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Samsung AC',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Connected',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isACon,
onChanged: (value) {
model.acSwitch(value);
},
),
],
),
SizedBox(
height: getProportionateScreenHeight(30),
),
// Divider(
// thickness: 2,
// ),
// SizedBox(
// height: 15,
// ),
Text(
'Mode',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Container(
height: getProportionateScreenHeight(50),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: ToggleButtons(
selectedColor: Colors.white,
fillColor: const Color(0xFF464646),
renderBorder: false,
borderRadius: BorderRadius.circular(15),
textStyle: Theme.of(context)
.textTheme
.headline2!
.copyWith(color: Colors.white),
children: <Widget>[
SizedBox(
width: getProportionateScreenWidth(70),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
'assets/icons/svg/cool.svg',
color: model.isSelected[0]
? Colors.white
: const Color(0xFF808080),
height: getProportionateScreenHeight(
22,
),
),
const Text(
'Cool',
textAlign: TextAlign.center,
),
],
),
),
SizedBox(
width: getProportionateScreenWidth(57.5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
'assets/icons/svg/air.svg',
color: model.isSelected[1]
? Colors.white
: const Color(0xFF808080),
height: getProportionateScreenHeight(
22,
),
),
const Text(
'Air',
textAlign: TextAlign.center,
),
],
),
),
SizedBox(
width: getProportionateScreenWidth(57.5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
'assets/icons/svg/sun.svg',
color: model.isSelected[2]
? Colors.white
: const Color(0xFF808080),
height: getProportionateScreenHeight(
22,
),
),
const Text(
'Hot',
textAlign: TextAlign.center,
),
],
),
),
SizedBox(
width: getProportionateScreenWidth(57.5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SvgPicture.asset(
'assets/icons/svg/eco.svg',
color: model.isSelected[3]
? Colors.white
: const Color(0xFF808080),
height: getProportionateScreenHeight(
22,
),
),
const Text(
'Eco',
textAlign: TextAlign.center,
),
],
),
),
],
onPressed: (int index) {
model.onToggleTapped(index);
},
isSelected: model.isSelected,
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen/my_list_screen.dart | import 'package:flutter/material.dart';
import '../my_list_screen/components/body.dart';
class MyListScreen extends StatelessWidget {
static String routeName = '/my-list-screen';
const MyListScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
backgroundColor: Color(0xFFF2F2F2),
body: Body(),
);
}
} | 0 |
mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen | mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen/components/body.dart | import 'package:flutter/material.dart';
import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/my_list_screen/components/list_data.dart';
import 'package:domus/src/screens/my_list_screen/components/horizontal_list.dart';
class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child:Padding(
padding: EdgeInsets.only(
left: 10,
right: 10,
top: getProportionateScreenHeight(50),
bottom: 20,
),
child:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 25, right: 15),
child: Row(
children: [
const Text(
'My List',
style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
),
const Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(
Icons.close,
size: 35,
),
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(15),
),
SizedBox(
height: getProportionateScreenHeight(130),
width: getProportionateScreenWidth(270),
child: MoviesList(movies: ListData().movies),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: getProportionateScreenHeight(7),
),
child: const Text(
'Europe movie',
style: TextStyle(fontSize: 19,),
),
),
SizedBox(
height: getProportionateScreenHeight(130),
width: getProportionateScreenWidth(270),
child: MoviesList(movies: ListData().movies),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: getProportionateScreenHeight(7),
),
child: const Text(
'Romance/Drama',
style: TextStyle(fontSize: 19,),
),
),
SizedBox(
height: getProportionateScreenHeight(130),
width: getProportionateScreenWidth(270),
child: MoviesList(movies: ListData().movies),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: getProportionateScreenHeight(7),
),
child: const Text(
'Action/Thriller',
style: TextStyle(fontSize: 19,),
),
),
SizedBox(
height: getProportionateScreenHeight(130),
width: getProportionateScreenWidth(270),
child: MoviesList(movies: ListData().movies),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen | mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen/components/list_data.dart |
class ListData{
List<String> movies = ['movie1.png','movie2.png','movie3.png','movie4.png'];
} | 0 |
mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen | mirrored_repositories/smart-home-app/lib/src/screens/my_list_screen/components/horizontal_list.dart |
import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class MoviesList extends StatelessWidget {
const MoviesList({Key? key,required this.movies}) : super(key: key);
final List movies;
@override
Widget build(BuildContext context) {
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: movies.length,
itemBuilder: (BuildContext context, int index){
return Padding(
padding: const EdgeInsets.only(
right: 8,
),
child:Image.asset(
'assets/images/movies/${movies[index]}',
height: getProportionateScreenHeight(130),
width: getProportionateScreenWidth(80),
fit: BoxFit.contain,
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/savings_screen.dart | import 'package:flutter/material.dart';
import 'package:domus/src/screens/savings_screen/components/body.dart';
class SavingsScreen extends StatelessWidget {
static String routeName = '/savings-screen';
const SavingsScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: const Scaffold(
backgroundColor: Color(0xFFF2F2F2),
body: Body(),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/savings_screen | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/components/savings_widget.dart |
import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'devices_list.dart';
import 'doughnut_chart.dart';
class Savings extends StatefulWidget {
const Savings({Key? key, required this.title, required this.savings}) : super(key: key);
final String title;
final int savings;
@override
State<Savings> createState() => _SavingsState();
}
class _SavingsState extends State<Savings> {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenHeight(0),
vertical: getProportionateScreenHeight(10)
),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(25)),
color: const Color(0xFFBDBDBD).withOpacity(0.15),
),
child: Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(10)),
child: Row(
children: [
DoughnutChart(totalSavings:widget.savings, period: widget.title),
Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 15,bottom: 10),
child: Text(
widget.title,
textAlign: TextAlign.left,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold
),
),
),
SizedBox(
width: getProportionateScreenHeight(125),
height: getProportionateScreenHeight(60),
child: DevicesList()),
],
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/savings_screen | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/components/chart_data.dart |
import 'package:awesome_circular_chart/awesome_circular_chart.dart';
import 'package:flutter/material.dart';
class ChartData{
//list of devices
List<String> devices = ['Air Conditioner','Lights','Geaser'];
//list of colors representing devices
List<Color> colors = [
const Color.fromRGBO(255, 197, 66, 1),
const Color.fromRGBO(61, 213, 152, 1),
const Color.fromRGBO(255, 87, 95, 1) ,
];
//function to get the data for doughnut chart
List<CircularStackEntry> getChartData(String period) {
final List<CircularStackEntry> chartData = [
CircularStackEntry(
getEntry(period)
)
];
return chartData;
}
//dummy data for monthly savings in form of percentage i.e. 50 means 50%
final List<CircularSegmentEntry> _monthlySavings = <CircularSegmentEntry>[
const CircularSegmentEntry(50,Color.fromRGBO(255, 197, 66, 1),rankKey: 'Air Conditioner'),
const CircularSegmentEntry(10, Color.fromRGBO(255, 87, 95, 1),rankKey: 'Lights'),
const CircularSegmentEntry(20, Color.fromRGBO(61, 213, 152, 1),rankKey: 'Geaser'),
const CircularSegmentEntry(100, Color.fromRGBO(42, 60, 68, 1),rankKey: 'remaining'),
];
//dummy data for weekly savings
final List<CircularSegmentEntry> _weeklySavings = <CircularSegmentEntry>[
const CircularSegmentEntry(50,Color.fromRGBO(255, 197, 66, 1),rankKey: 'Air Conditioner'),
const CircularSegmentEntry(10, Color.fromRGBO(255, 87, 95, 1),rankKey: 'Lights'),
const CircularSegmentEntry(20, Color.fromRGBO(61, 213, 152, 1),rankKey: 'Geaser'),
const CircularSegmentEntry(100, Color.fromRGBO(42, 60, 68, 1),rankKey: 'remaining')
];
List<CircularSegmentEntry> getEntry(String period) {
if(period == 'Monthly savings') {
return _monthlySavings;
} else {
return _weeklySavings;
}
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/savings_screen | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/components/doughnut_chart.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/savings_screen/components/chart_data.dart';
import 'package:flutter/material.dart';
import 'package:awesome_circular_chart/awesome_circular_chart.dart';
class DoughnutChart extends StatefulWidget {
const DoughnutChart({Key? key, required this.period, required this.totalSavings}) : super(key: key);
final String period;
final int totalSavings;
@override
State<DoughnutChart> createState() => _DoughnutChartState();
}
class _DoughnutChartState extends State<DoughnutChart> {
final GlobalKey<AnimatedCircularChartState> _chartKey = GlobalKey<AnimatedCircularChartState>();
late List<CircularStackEntry> _data;
@override
void initState() {
_data = ChartData().getChartData(widget.period);
super.initState();
}
@override
Widget build(BuildContext context) {
return AnimatedCircularChart(
key: _chartKey,
initialChartData: _data,
chartType: CircularChartType.Radial,
//size of the doughnut chart
size: Size(
getProportionateScreenWidth(90),
getProportionateScreenHeight(90)
),
//radius of the inner circle
holeRadius: getProportionateScreenHeight(28),
holeLabel: '${widget.totalSavings}\$',
labelStyle: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black,
),
edgeStyle: SegmentEdgeStyle.round,
//duration of the animation
duration: const Duration(milliseconds: 1000),
percentageValues: true,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/savings_screen | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/components/devices_list.dart |
import 'package:domus/src/screens/savings_screen/components/chart_data.dart';
import 'package:flutter/material.dart';
class DevicesList extends StatelessWidget {
DevicesList({Key? key}) : super(key: key);
final List devices = ChartData().devices;
final List color = ChartData().colors;
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: devices.length,
padding: const EdgeInsets.all(0),
itemBuilder: (BuildContext context, int index){
return SizedBox(
height: 25,
child: ListTile(
visualDensity: const VisualDensity(vertical: -4,horizontal: -4),
dense: true,
contentPadding: const EdgeInsets.only(left: 2),
minLeadingWidth: 10,
leading: SizedBox(
width: 20,
height: 15,
child: Card(
color: color[index],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6)
),
)
),
title: Text(
devices[index],
style: const TextStyle(
color: Color.fromRGBO(150, 167, 175, 1),
fontSize: 14
),
),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/savings_screen | mirrored_repositories/smart-home-app/lib/src/screens/savings_screen/components/body.dart | import 'package:domus/src/screens/savings_screen/components/savings_widget.dart';
import 'package:flutter/material.dart';
import 'package:domus/config/size_config.dart';
import 'package:flutter_svg/svg.dart';
class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(10),
right: getProportionateScreenWidth(10),
bottom: getProportionateScreenHeight(15),
),
child: Column(
children: [
SizedBox(
height: getProportionateScreenHeight(50),
),
Padding(
padding: const EdgeInsets.only(left: 7, right: 7),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
children: [
const Text(
'Savings',
style: TextStyle(fontSize: 36, fontWeight: FontWeight.bold),
),
const Spacer(),
SvgPicture.asset(
'assets/icons/svg/savings_filled.svg'
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
const Savings(title: 'Weekly savings',savings: 12),
const Savings(title: 'Monthly savings',savings: 39),
],
),
),
],
)
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/set_event_screen.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:domus/src/screens/set_event_screen/components.dart';
class SetEventScreen extends StatefulWidget {
static String routeName = '/set-event-screen';
const SetEventScreen({Key? key}) : super(key: key);
@override
State<SetEventScreen> createState() => _SetEventScreenState();
}
class _SetEventScreenState extends State<SetEventScreen> {
Map<DateTime, List<Event>> eventsForDay = {};
TextEditingController controller = TextEditingController();
DateTime today = DateTime.now();
DateTime focusedDay = DateTime.now();
DateTime? selectedDay;
List<Event> getEventsForDay(DateTime? day) {
return (day == null) ? [] : eventsForDay[day] ?? [];
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
iconTheme: Theme.of(context).iconTheme,
title: Padding(
padding: const EdgeInsets.only(top: 20, left: 15),
child: Text(
'Set Events',
style: SetEventScreenTheme.appBarTextStyle,
),
),
elevation: 0,
actions: const <Widget>[
Padding(
padding: EdgeInsets.only(top: 20, right: 15),
child: CloseButton(),
),
],
),
body: ListView(
padding: const EdgeInsets.symmetric(horizontal: 20),
children: [
TableCalendar(
firstDay: DateTime.utc(today.year, today.month),
lastDay: DateTime.utc(today.year + 1, today.month),
focusedDay: focusedDay,
sixWeekMonthsEnforced: true,
calendarStyle: CalendarTheme.calendarStyle(),
headerStyle: CalendarTheme.headerStyle(),
daysOfWeekStyle: CalendarTheme.daysOfWeekStyle(),
daysOfWeekHeight: 32,
startingDayOfWeek: StartingDayOfWeek.monday,
selectedDayPredicate: (day) => isSameDay(selectedDay, day),
onDaySelected: (selectedDay, focusedDay) {
setState(() {
this.selectedDay = selectedDay;
this.focusedDay = focusedDay;
});
},
eventLoader: getEventsForDay,
),
const SizedBox(height: 32),
...getEventsForDay(selectedDay).map(
(event) => EventListTile(text: event.toString()),
),
const SizedBox(height: 48),
],
),
floatingActionButton: FloatingActionButton.extended(
extendedPadding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(48),
),
onPressed: () {
if (selectedDay == null) {
showDialog(
context: context,
builder: (context) => const SelectDayDialog(),
);
} else {
showDialog(
context: context,
builder: (context) => AddEventDialog(
controller: controller,
onCancel: () => Navigator.pop(context),
onAccept: () {
if (controller.text.isNotEmpty) {
// Add the Event to the List of Events
if (eventsForDay[selectedDay] == null) {
// If this is the first event
eventsForDay[selectedDay!] = [Event(controller.text)];
} else {
eventsForDay[selectedDay]!.add(Event(controller.text));
}
}
Navigator.pop(context);
controller.clear();
setState(() {});
},
),
);
}
},
label: const Text('Add New Event'),
icon: const Icon(Icons.add_rounded),
backgroundColor: const Color(0xFF464646),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
resizeToAvoidBottomInset: false,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components.dart | export 'components/event.dart';
export 'components/event_list_tile.dart';
export 'components/add_event_dialog.dart';
export 'components/select_day_dialog.dart';
export 'components/set_event_screen_theme.dart';
export 'components/calendar_theme.dart';
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/event.dart | // Defines an event
class Event {
Event(this.text);
final String text;
@override
String toString() => text;
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/set_event_screen_theme.dart | import 'package:flutter/material.dart';
abstract class SetEventScreenTheme {
static TextStyle get appBarTextStyle {
return const TextStyle(
fontFamily: 'ABeeZee',
color: Colors.black,
fontSize: 30,
fontWeight: FontWeight.w500,
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/calendar_theme.dart | import 'package:flutter/material.dart';
import 'package:table_calendar/table_calendar.dart';
// Defines the CalendarTheme for the Table Calendar
abstract class CalendarTheme {
static CalendarStyle calendarStyle() {
return const CalendarStyle(
outsideDaysVisible: false,
defaultTextStyle: TextStyle(
color: Colors.black,
fontFamily: 'ABeeZee',
),
todayDecoration: BoxDecoration(
color: Color(0xFF8CF0C8),
shape: BoxShape.circle,
),
todayTextStyle: TextStyle(
color: Colors.black,
fontFamily: 'ABeeZee',
),
selectedDecoration: BoxDecoration(
color: Color(0xFF3DD598),
shape: BoxShape.circle,
),
selectedTextStyle: TextStyle(
color: Colors.black,
fontFamily: 'ABeeZee',
),
weekendTextStyle: TextStyle(
color: Color(0xFFFF8178),
fontFamily: 'ABeeZee',
),
rowDecoration: BoxDecoration(color: Color(0xFFF2F2F2)),
);
}
static HeaderStyle headerStyle() {
return const HeaderStyle(
formatButtonVisible: false,
titleCentered: true,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10),
),
),
headerMargin: EdgeInsets.only(top: 32),
titleTextStyle: TextStyle(
fontFamily: 'ABeeZee',
fontWeight: FontWeight.bold,
fontSize: 17,
),
);
}
static DaysOfWeekStyle daysOfWeekStyle() {
return const DaysOfWeekStyle(
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
border: Border.symmetric(
horizontal: BorderSide(
width: 0.25,
color: Color(0xFF696969),
),
),
),
weekendStyle: TextStyle(
color: Color(0xFFFF8178),
fontFamily: 'ABeeZee',
fontWeight: FontWeight.w500,
),
weekdayStyle: TextStyle(
color: Colors.black,
fontFamily: 'ABeeZee',
fontWeight: FontWeight.w500,
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/add_event_dialog.dart | import 'package:domus/popups/popup_form.dart';
import 'package:domus/popups/popup_widgets.dart';
import 'package:flutter/material.dart';
class AddEventDialog extends StatelessWidget {
const AddEventDialog({
Key? key,
required this.controller,
required this.onAccept,
required this.onCancel,
}) : super(key: key);
final TextEditingController controller;
final VoidCallback onAccept;
final VoidCallback onCancel;
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: PopupForm(
popupTitle: 'Add an Event',
popupSubtitle: 'Add an event to mark it on the calendar',
popupFormContent: [
PopupFormField(
popupHintText: 'Your Event',
popupIcon: const Icon(Icons.event_rounded),
textController: controller,
),
],
popupFormActions: <Widget>[
PopupOutlinedButton(
onPressed: onCancel,
text: 'Cancel',
),
PopupFilledButton(
onPressed: onAccept,
text: 'Ok',
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/select_day_dialog.dart | import 'package:domus/popups/popup_warning.dart';
import 'package:domus/popups/popup_widgets.dart';
import 'package:flutter/material.dart';
class SelectDayDialog extends StatelessWidget {
const SelectDayDialog({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return PopupWarning(
popupTitle: 'Please Select a Day!',
popupSubtitle: 'Select by tapping on a day',
popupActions: <Widget>[
PopupFilledButton(
onPressed: () => Navigator.pop(context),
text: 'Ok',
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen | mirrored_repositories/smart-home-app/lib/src/screens/set_event_screen/components/event_list_tile.dart | import 'package:flutter/material.dart';
class EventListTile extends StatelessWidget {
const EventListTile({
Key? key,
required this.text,
}) : super(key: key);
final String text;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 10),
child: ListTile(
title: Text(text),
leading: const Icon(
Icons.event_rounded,
color: Color(0xFFFFC542),
),
trailing: const Icon(Icons.chevron_right_rounded),
tileColor: const Color(0xFFF2F2F2),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.horizontal(
right: Radius.circular(10),
left: Radius.circular(10),
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/smart_tv/smart_tv.dart | import 'package:domus/provider/base_view.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:domus/src/screens/smart_tv/components/expandable_bottom_sheet.dart';
import 'package:domus/view/smart_tv_view_model.dart';
import 'components/body.dart';
class SmartTV extends StatelessWidget {
static String routeName = '/smart-tv';
const SmartTV({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<SmartTvViewModel>(
onModelReady: (model) => {},
builder: (context, model, child) {
return Material(
child: SlidingUpPanel(
controller: model.pc,
backdropEnabled: true,
boxShadow: const [],
body: Scaffold(
backgroundColor: const Color(0xFFF2F2F2),
body: Body(
model: model,
),
),
panel: ExpandableBottomSheet(model: model),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_tv | mirrored_repositories/smart-home-app/lib/src/screens/smart_tv/components/mood_toggle_buttons.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:domus/view/smart_tv_view_model.dart';
class MoodToggleButtons extends StatelessWidget {
const MoodToggleButtons({Key? key, required this.model})
: super(key: key);
final SmartTvViewModel model;
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
15,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Mood',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(9),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: ToggleButtons(
selectedColor: Colors.white,
fillColor: const Color(0xFF464646),
renderBorder: false,
borderRadius: BorderRadius.circular(15),
children: <Widget>[
SizedBox(
width: getProportionateScreenWidth(80),
child: const Text(
'TV Shows',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
),
),
),
SizedBox(
width: getProportionateScreenWidth(80),
child: const Text(
'Movies',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
),
),
),
SizedBox(
width: getProportionateScreenWidth(80),
child: const Text(
'My List',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
),
),
),
],
onPressed: (int index) {
model.onToggleTapped(index,context);
},
isSelected: model.isSelected,
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_tv | mirrored_repositories/smart-home-app/lib/src/screens/smart_tv/components/expandable_bottom_sheet.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:domus/view/smart_tv_view_model.dart';
class ExpandableBottomSheet extends StatelessWidget {
const ExpandableBottomSheet({Key? key, required this.model})
: super(key: key);
final SmartTvViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Night Mode',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Set room light',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: true,
onChanged: (value) {},
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
SizedBox(
height: getProportionateScreenHeight(20),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_tv | mirrored_repositories/smart-home-app/lib/src/screens/smart_tv/components/intensity_slider.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:domus/view/smart_tv_view_model.dart';
class Intensity extends StatelessWidget {
const Intensity({Key? key, required this.model})
: super(key: key);
final SmartTvViewModel model;
@override
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
15,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Intensity',
style: Theme.of(context).textTheme.headline2,
),
Text(
'${model.lightIntensity.toInt()}%',
style: Theme.of(context).textTheme.headline2,
),
],
),
),
SliderTheme(
data: SliderThemeData(
trackHeight: getProportionateScreenHeight(5),
thumbColor: const Color(0xFF464646),
activeTrackColor: const Color(0xFF464646),
inactiveTrackColor: Colors.white,
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8)),
child: Slider(
min: 0,
max: 100,
onChanged: (val) {
model.changeTvIntensity(val);
},
value: model.lightIntensity,
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
15,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Off',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'100%',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_tv | mirrored_repositories/smart-home-app/lib/src/screens/smart_tv/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/smart_tv/components/mood_toggle_buttons.dart';
import 'package:domus/view/smart_tv_view_model.dart';
import 'package:flutter/material.dart';
import 'package:domus/src/screens/smart_tv/components/intensity_slider.dart';
class Body extends StatelessWidget {
final SmartTvViewModel model;
const Body({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return Stack(
children: [
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding: EdgeInsets.only(
top: getProportionateScreenHeight(50),
),
child: Image.asset(
'assets/images/tv.png',
height: getProportionateScreenHeight(450),
width: getProportionateScreenWidth(260),
fit: BoxFit.contain,
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(19),
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined)),
Stack(
children: [
Text(
'Living\nRoom',
style: Theme.of(context)
.textTheme
.headline1!
.copyWith(
fontSize: 45,
color: const Color(0xFFBDBDBD)
.withOpacity(0.5),
),
),
Text(
'Smart\nTv',
style: Theme.of(context).textTheme.headline1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(26),
),
Text(
'Power',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(4),
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isTvOff,
onChanged: (value) {
model.tvSwitch(value);
},
),
SizedBox(
height: getProportionateScreenHeight(90),
),
],
),
),
],
),
),
MoodToggleButtons(model: model),
Intensity(model: model),
],
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker/smart_speaker.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/provider/base_view.dart';
import 'package:domus/view/smart_speaker_view_model.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'components/body.dart';
import 'components/expandable_bottom_sheet.dart';
class SmartSpeaker extends StatelessWidget {
static String routeName = 'smart-speaker';
const SmartSpeaker({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<SmartSpeakerViewModel>(
onModelReady: (model) => {},
builder: (context, model, child) {
return Material(
child: SlidingUpPanel(
minHeight: getProportionateScreenHeight(70),
controller: model.pc,
backdropEnabled: true,
boxShadow: const [],
body: Scaffold(
backgroundColor: const Color(0xFFF2F2F2),
body: Body(
model: model,
),
),
panel: ExpandableBottomSheet(model: model),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker | mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker/components/connect_speaker.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class ConnectSpeaker extends StatelessWidget {
const ConnectSpeaker({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
Align(
alignment: Alignment.centerLeft,
child: InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined),
),
),
Text(
'Kakao Mini C',
style: Theme.of(context).textTheme.headline1,
),
Text(
'Smart Speaker',
style: Theme.of(context).textTheme.headline3,
),
SizedBox(
height: getProportionateScreenHeight(40),
),
Material(
child: Image.asset(
'assets/images/kakao_mini.png',
height: getProportionateScreenHeight(300),
width: getProportionateScreenWidth(150),
fit: BoxFit.contain,
),
color: Colors.transparent,
),
SizedBox(
height: getProportionateScreenHeight(40),
),
OutlinedButton(
onPressed: () {},
child: Text(
'Connect',
style: Theme.of(context).textTheme.headline3,
),
style: OutlinedButton.styleFrom(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(80),
vertical: getProportionateScreenHeight(10),
),
shape: const StadiumBorder(),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker | mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker/components/expandable_bottom_sheet.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_speaker_view_model.dart';
import 'package:flutter/material.dart';
class ExpandableBottomSheet extends StatelessWidget {
const ExpandableBottomSheet({Key? key, required this.model})
: super(key: key);
final SmartSpeakerViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Schedule',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Set schedule speaker',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: true,
onChanged: (value) {},
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Volume',
style: Theme.of(context).textTheme.headline2,
),
Text(
'${model.speakerVolume.toInt()}%',
style: Theme.of(context).textTheme.headline2,
),
],
),
SliderTheme(
data: SliderThemeData(
trackHeight: getProportionateScreenHeight(5),
thumbColor: const Color(0xFF464646),
activeTrackColor: const Color(0xFF464646),
inactiveTrackColor: Colors.white,
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8)),
child: Slider(
min: 0,
max: 100,
onChanged: (val) {
model.changeSpeakerVolume(val);
},
value: model.speakerVolume,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Off',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'100%',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(9),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Marshell sound dock',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'on',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isSpeakeron,
onChanged: (value) {
model.speakerSwitch(value);
},
),
],
),
SizedBox(
height: getProportionateScreenHeight(9),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Bass',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'off',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isSpeakeron,
onChanged: (value) {
model.speakerSwitch(value);
},
),
],
),
SizedBox(
height: getProportionateScreenHeight(9),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker | mirrored_repositories/smart-home-app/lib/src/screens/smart_speaker/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_speaker_view_model.dart';
import 'package:flutter/material.dart';
import 'package:sleek_circular_slider/sleek_circular_slider.dart';
class Body extends StatelessWidget {
final SmartSpeakerViewModel model;
const Body({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(19),
top: getProportionateScreenHeight(5),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined)),
Stack(
children: [
Text(
'Smart\nSpeaker',
style: Theme.of(context).textTheme.headline1!.copyWith(
fontSize: 45,
color: const Color(0xFFBDBDBD).withOpacity(0.5),
),
),
Text(
'Living\nRoom',
style: Theme.of(context).textTheme.headline1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(10),
),
],
),
),
Align(
alignment: Alignment.center,
child: SleekCircularSlider(
min: 5,
max: 40,
initialValue: 23,
appearance: CircularSliderAppearance(
size: 200,
startAngle: 250,
angleRange: 360,
customColors: CustomSliderColors(
trackColor: const Color(0xFFBDBDBD),
progressBarColor: const Color(0xFF464646),
// hideShadow: true,
shadowColor: const Color(0xFFBDBDBD).withOpacity(0.1),
shadowMaxOpacity: 1,
shadowStep: 25,
),
customWidths: CustomSliderWidths(
progressBarWidth: 10,
handlerSize: 10,
trackWidth: 10,
shadowWidth: 10,
),
),
onChange: (double value) {
// callback providing a value while its being changed (with a pan gesture)
},
onChangeStart: (double startValue) {
// callback providing a starting value (when a pan gesture starts)
},
onChangeEnd: (double endValue) {
// ucallback providing an ending value (when a pan gesture ends)
},
innerWidget: (double value) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.asset(
'assets/images/stay.jpg',
//height: getProportionateScreenHeight(50),
fit: BoxFit.cover,
),
),
);
},
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Align(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'3:15 | 4:26',
style: Theme.of(context).textTheme.headline3,
),
SizedBox(
height: getProportionateScreenHeight(10),
),
Text(
'STAY',
style: Theme.of(context).textTheme.headline1,
),
Text(
'Justin Bieber Ft. Kid Laroi',
style: Theme.of(context).textTheme.headline4,
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.first_page_rounded,
size: 30,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.play_arrow_rounded,
size: 35,
color: Color(0xFFF2F2F2),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(8),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.last_page_rounded,
size: 30,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
)
],
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(15),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.playlist_play_rounded,
size: 30,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.shuffle_rounded,
size: 25,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.repeat_rounded,
size: 25,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.equalizer_rounded,
size: 25,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
),
ElevatedButton(
onPressed: () {},
child: const Icon(
Icons.favorite_rounded,
size: 25,
color: Color(0xFF464646),
),
style: ElevatedButton.styleFrom(
elevation: 0.0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(10),
),
)
],
),
SizedBox(
height: getProportionateScreenHeight(15),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Kakao Mini C',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Connected',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isSpeakeron,
onChanged: (value) {
model.speakerSwitch(value);
},
),
],
),
SizedBox(
height: getProportionateScreenHeight(9),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/home_screen.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/provider/base_view.dart';
import 'package:domus/src/screens/edit_profile/edit_profile.dart';
import 'package:domus/src/screens/favourites_screen/favourites_screen.dart';
import 'package:domus/src/widgets/custom_bottom_nav_bar.dart';
import 'package:domus/view/home_screen_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'components/body.dart';
import 'package:domus/src/screens/menu_page/menu_screen.dart';
class HomeScreen extends StatelessWidget {
static String routeName = '/home-screen';
const HomeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SizeConfig().init(context);
return BaseView<HomeScreenViewModel>(
onModelReady: (model) => {
model.generateRandomNumber(),
},
builder: (context, model, child) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
toolbarHeight: getProportionateScreenHeight(60),
elevation: 0,
iconTheme: const IconThemeData(color: Colors.black),
title: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
4,
),
),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Hi, Lex',
style: Theme.of(context).textTheme.headline1,
),
SizedBox(
width: getProportionateScreenWidth(60),
),
Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Color(0xffdadada),
borderRadius:
BorderRadius.all(Radius.elliptical(45, 45)),
),
child: IconButton(
splashRadius: 25,
icon: const Icon(
FontAwesomeIcons.solidUser,
color: Colors.amber,
),
onPressed: () {
// Navigator.of(context).pushNamed(EditProfile.routeName);
Navigator.push(context, MaterialPageRoute(builder: (context) => const EditProfile(),));
},
),
),
SizedBox(
width: getProportionateScreenWidth(5),
),
Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Color(0xffdadada),
borderRadius:
BorderRadius.all(Radius.elliptical(45, 45)),
),
child: IconButton(
splashRadius: 25,
icon: const Icon(
CupertinoIcons.heart_fill,
color: Colors.grey,
size: 30,
),
onPressed: () {
// Navigator.of(context).pushNamed(EditProfile.routeName);
Navigator.push(context, MaterialPageRoute(builder: (context) =>
Favourites(
model:model,
),));
},
),
),
],
),
),
bottom: PreferredSize(
child: TabBar(
isScrollable: true,
unselectedLabelColor: Colors.white.withOpacity(0.3),
indicatorColor: const Color(0xFF464646),
tabs: [
Tab(
child: Text(
'Living Room',
style: Theme.of(context).textTheme.headline3,
),
),
Tab(
child: Text(
'Dining',
style: Theme.of(context).textTheme.headline4,
),
),
Tab(
child: Text(
'Kitchen',
style: Theme.of(context).textTheme.headline4,
),
),
]),
preferredSize: Size.fromHeight(
getProportionateScreenHeight(
35,
),
),
),
),
drawer: SizedBox(
width: getProportionateScreenWidth(270),
child: const Menu()),
body: TabBarView(
children: <Widget>[
Body(
model: model,
),
Center(
child: Text(
'To be Built Soon',
style: Theme.of(context).textTheme.headline3,
),
),
const Center(
child: Text('under construction'),
),
],
),
bottomNavigationBar: CustomBottomNavBar(model: model),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/savings_container.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/home_screen_view_model.dart';
import 'package:flutter/material.dart';
class SavingsContainer extends StatelessWidget {
const SavingsContainer({Key? key, required this.model}) : super(key: key);
final HomeScreenViewModel model;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
height: getProportionateScreenHeight(85),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: const Color(0xFFFFFFFF),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
vertical: getProportionateScreenHeight(6),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Energy Saving',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 10,
),
Text(
'+35%',
style: Theme.of(context).textTheme.headline1!.copyWith(
color: Colors.green,
),
),
SizedBox(
height: getProportionateScreenHeight(5),
),
Text(
'23.5 kWh',
style: Theme.of(context).textTheme.headline5,
),
],
),
SizedBox(
width: getProportionateScreenWidth(90),
),
],
),
),
),
Positioned(
right: 0,
child: Image.asset(
'assets/images/thunder.png',
height: getProportionateScreenHeight(100),
width: getProportionateScreenWidth(140),
fit: BoxFit.contain,
),
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/music_widget.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class MusicWidget extends StatelessWidget {
const MusicWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: getProportionateScreenHeight(95),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: const Color(0xFFFFFFFF),
gradient: const LinearGradient(
stops: [0.02, 0.02], colors: [Colors.black, Colors.white]),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
vertical: getProportionateScreenHeight(6),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
width: getProportionateScreenHeight(50),
height: getProportionateScreenHeight(50),
decoration: const BoxDecoration(
color: Color(0xffdadada),
borderRadius: BorderRadius.all(Radius.elliptical(45, 45)),
),
child: SvgPicture.asset(
'assets/icons/svg/music.svg',
color: Colors.black,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Music',
style: Theme.of(context).textTheme.headline2,
),
Text(
'Give a Little Bit',
style: Theme.of(context).textTheme.headline4,
),
],
),
Row(
children: [
SvgPicture.asset(
'assets/icons/svg/prev.svg',
color: Colors.black,
width: getProportionateScreenWidth(16),
),
const SizedBox(
width: 10,
),
SvgPicture.asset(
'assets/icons/svg/play.svg',
color: Colors.black,
width: getProportionateScreenWidth(15),
),
const SizedBox(
width: 10,
),
SvgPicture.asset(
'assets/icons/svg/next.svg',
color: Colors.black,
width: getProportionateScreenWidth(16),
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/reusable_container.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class ReusableCard extends StatelessWidget {
const ReusableCard({
Key? key,
required this.title,
required this.icon1,
required this.isON,
required this.onTap,
}) : super(key: key);
final String title;
final String icon1;
final bool isON;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Container(
height: getProportionateScreenHeight(100),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: const Color(0xFFFFFFFF),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
vertical: getProportionateScreenHeight(6),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InkWell(onTap: onTap, child: Image.asset(icon1)),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: const Color(0xFFE4E4E4),
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: isON,
onChanged: (value) {},
),
],
),
InkWell(
onTap: onTap,
child: Text(
title,
style: Theme.of(context).textTheme.headline2,
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/weather_container.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/home_screen_view_model.dart';
import 'package:flutter/material.dart';
class WeatherContainer extends StatelessWidget {
const WeatherContainer({Key? key, required this.model}) : super(key: key);
final HomeScreenViewModel model;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(
height: getProportionateScreenHeight(100),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: const Color(0xFFFFFFFF),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
vertical: getProportionateScreenHeight(6),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: getProportionateScreenWidth(90),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'28°C',
style: Theme.of(context).textTheme.headline1,
),
Text(
'Cloudy',
style: Theme.of(context).textTheme.headline1,
),
SizedBox(
height: getProportionateScreenHeight(5),
),
Text(
'27 Mar 2022',
style: Theme.of(context).textTheme.headline5,
),
Text(
'Jagakarsa,Jakarta',
style: Theme.of(context).textTheme.headline5,
)
],
),
],
),
),
),
Image.asset(
'assets/images/weather/0.png',
height: getProportionateScreenHeight(110),
width: getProportionateScreenWidth(140),
fit: BoxFit.contain,
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/home_screen/components/music_widget.dart';
import 'package:domus/src/screens/home_screen/components/savings_container.dart';
import 'package:domus/src/screens/home_screen/components/weather_container.dart';
import 'package:domus/src/screens/set_event_screen/set_event_screen.dart';
import 'package:domus/src/screens/smart_ac/smart_ac.dart';
import 'package:domus/src/screens/smart_fan/smart_fan.dart';
import 'package:domus/src/screens/smart_light/smart_light.dart';
import 'package:domus/src/screens/smart_speaker/smart_speaker.dart';
import 'package:domus/view/home_screen_view_model.dart';
import 'package:domus/src/screens/smart_tv/smart_tv.dart';
import 'package:flutter/material.dart';
import 'add_device_widget.dart';
import 'dark_container.dart';
class Body extends StatelessWidget {
final HomeScreenViewModel model;
const Body({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(7),
vertical: getProportionateScreenHeight(7),
),
decoration: const BoxDecoration(
color: Color(0xFFF2F2F2),
),
child: Column(
children: [
Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: WeatherContainer(model: model),
),
Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: SavingsContainer(model: model),
),
Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: DarkContainer(
itsOn: model.isLightOn,
switchButton: model.lightSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartLight.routeName);
},
iconAsset: 'assets/icons/svg/light.svg',
device: 'Lightening',
deviceCount: '4 lamps',
switchFav: model.lightFav,
isFav: model.isLightFav,
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: DarkContainer(
itsOn: model.isACON,
switchButton: model.acSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartAC.routeName);
},
iconAsset: 'assets/icons/svg/ac.svg',
device: 'AC',
deviceCount: '4 devices',
switchFav: model.acFav,
isFav: model.isACFav,
),
),
),
],
),
Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: const MusicWidget(),
),
Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: DarkContainer(
itsOn: model.isSpeakerON,
switchButton: model.speakerSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartSpeaker.routeName);
},
iconAsset: 'assets/icons/svg/speaker.svg',
device: 'Speaker',
deviceCount: '1 device',
switchFav: model.speakerFav,
isFav: model.isSpeakerFav,
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(5)),
child: DarkContainer(
itsOn: model.isFanON,
switchButton: model.fanSwitch,
onTap: () {
Navigator.of(context).pushNamed(SmartFan.routeName);
},
iconAsset: 'assets/icons/svg/fan.svg',
device: 'Fan',
deviceCount: '2 devices',
switchFav: model.fanFav,
isFav: model.isFanFav,
),
),
),
],
),
Padding(
padding: EdgeInsets.all(getProportionateScreenHeight(8)),
child: const AddNewDevice(),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).pushNamed(SetEventScreen.routeName);
},
child: const Text(
'To SetEventScreen',
style: TextStyle(
color: Colors.black,
),
),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).pushNamed(SmartTV.routeName);
},
child: const Text(
'Smart TV Screen',
style: TextStyle(
color: Colors.black,
),
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/add_device_widget.dart | import 'package:domus/config/size_config.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
class AddNewDevice extends StatelessWidget {
const AddNewDevice({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(12),
padding: EdgeInsets.all(
getProportionateScreenHeight(5),
),
color: const Color(0xFFBDBDBD),
strokeWidth: 2,
dashPattern: const [9, 3],
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(15)),
child: Container(
height: getProportionateScreenHeight(55),
width: double.maxFinite,
color: const Color(0xFFF2F2F2),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.add,
color: Color(0xFFBDBDBD),
),
Text(
'Add New Device',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/home_screen | mirrored_repositories/smart-home-app/lib/src/screens/home_screen/components/dark_container.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class DarkContainer extends StatelessWidget {
final String iconAsset;
final VoidCallback onTap;
final String device;
final String deviceCount;
final bool itsOn;
final VoidCallback switchButton;
final bool isFav;
final VoidCallback switchFav;
const DarkContainer({
Key? key,
required this.iconAsset,
required this.onTap,
required this.device,
required this.deviceCount,
required this.itsOn,
required this.switchButton,
required this.isFav,
required this.switchFav,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
width: getProportionateScreenWidth(140),
height: getProportionateScreenHeight(140),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: itsOn
? const Color.fromRGBO(0, 0, 0, 1)
: const Color(0xffededed),
),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(10),
vertical: getProportionateScreenHeight(6),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: itsOn
? const Color.fromRGBO(45, 45, 45, 1)
: const Color(0xffdadada),
borderRadius:
const BorderRadius.all(Radius.elliptical(45, 45)),
),
child: SvgPicture.asset(
iconAsset,
color: itsOn ? Colors.amber : const Color(0xFF808080),
),
),
GestureDetector(
onTap: switchFav,
child: Icon(
Icons.star_rounded,
color: isFav ? Colors.amber:const Color(0xFF808080),
// color: Color(0xFF808080),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
device,
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline2!.copyWith(
color: itsOn ? Colors.white : Colors.black,
),
),
Text(
deviceCount,
textAlign: TextAlign.left,
style: const TextStyle(
color: Color.fromRGBO(166, 166, 166, 1),
fontSize: 13,
letterSpacing: 0,
fontWeight: FontWeight.normal,
height: 1.6),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
itsOn ? 'On' : 'Off',
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.headline2!.copyWith(
color: itsOn ? Colors.white : Colors.black,
),
),
GestureDetector(
onTap: switchButton,
child: Container(
width: 48,
height: 25.6,
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: itsOn ? Colors.black : const Color(0xffd6d6d6),
border: Border.all(
color: const Color.fromRGBO(255, 255, 255, 1),
width: itsOn ? 2 : 0,
),
),
child: Row(
children: [
itsOn ? const Spacer() : const SizedBox(),
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50),
),
),
],
),
),
)
],
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/about_screen/about_us_screen.dart | import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class AboutUs extends StatelessWidget {
static String routeName = '/about-us';
const AboutUs({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: [
ListTile(
leading: const Text('About',
style: TextStyle(
fontSize: 36,
fontFamily: 'Lexend',
fontWeight: FontWeight.w600
),),
trailing: SvgPicture.asset('assets/icons/svg/info.svg')
// Icon(Icons.info, color: Colors.black, size: 32,),
),
Padding(
padding: const EdgeInsets.only(top: 12),
child: Center(child: Column(
children: const [
Text('Domus',style: TextStyle(fontFamily: 'Lexend',
fontSize: 48,
fontWeight: FontWeight.w700
),),
Text('Smart Home App',style: TextStyle(
fontSize: 24,
fontFamily: 'Lexend',
fontWeight: FontWeight.w300,
color: Color(0xff9B9B9B)
),),
SizedBox(height: 11,),
Text('Version: 1.0.1 (alpha)',style: TextStyle(
fontSize: 18,
fontFamily: 'Lexend',
fontWeight: FontWeight.w300
),),
],
)),
),
const SizedBox(height: 39,),
ListTile(
contentPadding: const EdgeInsets.only(left: 33.7,right: 10),
leading: SvgPicture.asset('assets/icons/svg/profile.svg'),
title: const Text('Lead Developer',
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Lexend',
fontSize: 20,
),
),
subtitle: const Text('Lakhan Kumawat',
style: TextStyle(
fontSize: 14,
fontFamily: 'Lexend',
fontWeight: FontWeight.w300
),),
onTap: (){},
),
const SizedBox(height: 12,),
ListTile(
contentPadding: const EdgeInsets.only(left: 33.7,right: 10),
leading: SvgPicture.asset('assets/icons/svg/team.svg'),
title: const Text('Domus Team',
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Lexend',
fontSize: 20,
),
),
subtitle: const Text('People who help with development and testing',
style: TextStyle(
fontSize: 14,
fontFamily: 'Lexend',
),),
onTap: (){},
),
const SizedBox(height: 12,),
ListTile(
contentPadding: const EdgeInsets.only(left: 33.7,right: 10),
leading: SvgPicture.asset('assets/icons/svg/star.svg',),
title: const Text('Acknowledgement',
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Lexend',
fontSize: 20,
),
),
subtitle: const Text('People and open source projects that helped the development of Domus',
style: TextStyle(
fontSize: 14,
fontFamily: 'Lexend',
),),
onTap: (){},
),
const SizedBox(height: 12,),
ListTile(
contentPadding: const EdgeInsets.only(left: 33.7,right: 10),
leading: SvgPicture.asset('assets/icons/svg/help.svg'),
title: const Text('Help',
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Lexend',
fontSize: 20,
),
),
subtitle: const Text('Answers to frequently asked questions',
style: TextStyle(
fontSize: 14,
fontFamily: 'Lexend',
),),
onTap: (){},
),
const SizedBox(height: 12,),
ListTile(
contentPadding: const EdgeInsets.only(left: 33.7,right: 10),
leading: SvgPicture.asset('assets/icons/svg/chat.svg'),
title: const Text('Social Networks',
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Lexend',
fontSize: 20,
),
),
subtitle: const Text('Follow Domus on social networks',
style: TextStyle(
fontSize: 14,
fontFamily: 'Lexend',
),),
onTap: (){},
),
Padding(
padding: const EdgeInsets.only(top: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Made with ',style: TextStyle(
fontSize: 18,
fontFamily: 'Lexend',
fontWeight: FontWeight.w300
),),
SvgPicture.asset('assets/icons/svg/heart.svg'),
const Text(' in IN',style: TextStyle(
fontSize: 18,
fontFamily: 'Lexend',
fontWeight: FontWeight.w300
),),
],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/smart_light.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/provider/base_view.dart';
import 'package:domus/view/smart_light_view_model.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'components/body.dart';
import 'components/color_pick_sheet.dart';
import 'components/expandable_bottom_sheet.dart';
class SmartLight extends StatelessWidget {
static String routeName = '/smart-light';
const SmartLight({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<SmartLightViewModel>(
onModelReady: (model) => {},
builder: (context, model, child) {
return Material(
child: SlidingUpPanel(
controller: model.pc,
backdropEnabled: true,
maxHeight: model.isTappedOnColor
? getProportionateScreenHeight(300)
: getProportionateScreenHeight(510),
color: const Color(0xFFF2F2F2),
boxShadow: const [],
///no Shadow
onPanelClosed: model.onPanelClosed,
body: Body(
model: model,
),
// panel:
panelBuilder: (sc) => model.isTappedOnColor
? ColorPickerSheet(
model: model,
)
: ExpandableBottomSheet(
model: model,
),
),
);
});
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/color_pick_sheet.dart | import 'package:domus/src/screens/smart_light/components/color_dot.dart';
import 'package:domus/src/screens/smart_light/components/reusable_buttons.dart';
import 'package:domus/view/smart_light_view_model.dart';
import 'package:flutter/material.dart';
import 'package:domus/constant/constant.dart';
class ColorPickerSheet extends StatelessWidget {
const ColorPickerSheet({Key? key, required this.model}) : super(key: key);
final SmartLightViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Color',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Pick Light Color',
style: Theme.of(context).textTheme.headline5,
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
const SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: Constants.colors
.map(
(e) => ColorDot(
index: e.index,
isSelected: e.index == model.selectedIndex,
dotColor: e.color,
model: model,
),
)
.toList(),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: Constants.dotColors2
.map(
(e) => ColorDot(
index: e.value,
isSelected: false,
dotColor: e,
model: model,
),
)
.toList(),
),
const SizedBox(
height: 25,
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: ResuableButton(
active: false,
buttonText: 'Cancel',
onPress: () {
model.pc.close();
}),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: ResuableButton(
active: true,
buttonText: 'Set Color',
onPress: () {
model.pc.close();
model.changeImage();
}),
),
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/expandable_bottom_sheet.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/smart_light/components/date_container.dart';
import 'package:domus/src/screens/smart_light/components/reusable_buttons.dart';
import 'package:domus/src/screens/smart_light/components/time_container.dart';
import 'package:domus/view/smart_light_view_model.dart';
import 'package:flutter/material.dart';
import 'advance_setting_container.dart';
class ExpandableBottomSheet extends StatelessWidget {
const ExpandableBottomSheet({Key? key, required this.model})
: super(key: key);
final SmartLightViewModel model;
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = const BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: radius),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10),
child: ListView(
children: [
const SizedBox(
height: 10,
),
Align(
alignment: Alignment.topCenter,
child: Container(
width: 35,
height: 4,
decoration: const BoxDecoration(
color: Color(0xFF464646),
borderRadius: BorderRadius.all(Radius.circular(12.0))),
),
),
const SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Schedule',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Set schedule room light',
style: Theme.of(context).textTheme.headline5,
)
],
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: true,
onChanged: (value) {},
),
],
),
const SizedBox(
height: 15,
),
const Divider(
thickness: 2,
),
const SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'January 2022',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 5,
),
Text(
'Select the desired date',
style: Theme.of(context).textTheme.headline5,
)
],
),
Row(
children: const [
Icon(Icons.arrow_back_ios_outlined),
SizedBox(
width: 20,
),
Icon(Icons.arrow_forward_ios_outlined),
],
),
],
),
SizedBox(
height: getProportionateScreenHeight(10),
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: const [
DateContainer(date: '01', day: 'Sat', active: true),
DateContainer(date: '02', day: 'Sun', active: false),
DateContainer(date: '03', day: 'Mon', active: false),
DateContainer(date: '04', day: 'Tue', active: true),
],
),
),
const SizedBox(
height: 20,
),
Text(
'Select the desired time',
style: Theme.of(context).textTheme.headline5,
),
SizedBox(
height: getProportionateScreenHeight(10),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'On Time',
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(
height: 10,
),
const TimeContainer(
time: '10:27', meridiem: 'PM', active: true),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Off Time',
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(
height: 10,
),
const TimeContainer(
time: '7:30', meridiem: 'AM', active: false),
],
),
],
),
const SizedBox(
height: 30,
),
Text(
'Advance setting',
style: Theme.of(context).textTheme.headline2,
),
const SizedBox(
height: 20,
),
const AdvanceSettings(),
const SizedBox(
height: 30,
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: ResuableButton(
active: false, buttonText: 'Clear all', onPress: () {}),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: ResuableButton(
active: true, buttonText: 'Schedule', onPress: () {}),
),
),
],
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/color_dot.dart | import 'package:domus/view/smart_light_view_model.dart';
import 'package:flutter/material.dart';
class ColorDot extends StatelessWidget {
const ColorDot({
Key? key,
required this.isSelected,
required this.dotColor,
required this.index,
required this.model,
}) : super(key: key);
final bool isSelected;
final Color dotColor;
final int index;
final SmartLightViewModel model;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
model.changeColor(currentIndex: index);
},
child: Container(
height: 22,
width: 22,
margin: const EdgeInsets.symmetric(vertical: 20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: isSelected ? dotColor : Colors.white,
border: Border.all(
color: dotColor,
width: 3,
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/reusable_buttons.dart | import 'package:flutter/material.dart';
class ResuableButton extends StatelessWidget {
const ResuableButton({
Key? key,
required this.buttonText,
required this.active,
required this.onPress,
}) : super(key: key);
final String buttonText;
final bool active;
final VoidCallback onPress;
@override
Widget build(BuildContext context) {
return active
? ElevatedButton(
onPressed: onPress,
child: Text(
buttonText,
style: Theme.of(context).textTheme.headline2!.copyWith(
color: Colors.white,
),
),
style: ElevatedButton.styleFrom(
//primary: const Color(0xFF464646),
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), // <-- Radius
),
),
)
: OutlinedButton(
onPressed: onPress,
child: Text(
buttonText,
style: Theme.of(context).textTheme.headline2,
),
style: OutlinedButton.styleFrom(
// primary: const Color(0xFF464646),
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/advance_setting_container.dart | import 'package:flutter/material.dart';
class AdvanceSettings extends StatelessWidget {
const AdvanceSettings({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 55,
width: 400,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
border: Border.all(
color: const Color(0xFFBDBDBD),
width: 2,
),
),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Tone & intensity',
style: Theme.of(context).textTheme.headline2,
),
const Icon(Icons.arrow_forward_ios_outlined)
],
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/time_container.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class TimeContainer extends StatelessWidget {
const TimeContainer({
Key? key,
required this.time,
required this.meridiem,
required this.active,
}) : super(key: key);
final String time;
final String meridiem;
final bool active;
@override
Widget build(BuildContext context) {
return Container(
height: getProportionateScreenHeight(30),
width: getProportionateScreenWidth(115),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: active ? const Color(0xFF464646) : const Color(0xFFBDBDBD),
width: 2,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
time,
style: Theme.of(context).textTheme.headline2!.copyWith(
color:
active ? const Color(0xFF464646) : const Color(0xFFBDBDBD)),
),
VerticalDivider(
thickness: 2,
color: active ? const Color(0xFF464646) : const Color(0xFFBDBDBD),
),
Text(
meridiem,
style: Theme.of(context).textTheme.headline2!.copyWith(
color:
active ? const Color(0xFF464646) : const Color(0xFFBDBDBD)),
),
],
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/view/smart_light_view_model.dart';
import 'package:flutter/material.dart';
class Body extends StatelessWidget {
final SmartLightViewModel model;
const Body({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(19),
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(19),
top: getProportionateScreenHeight(7),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(Icons.arrow_back_outlined)),
Stack(
children: [
Text(
'Living\nRoom',
style: Theme.of(context)
.textTheme
.headline1!
.copyWith(
fontSize: 45,
color: const Color(0xFFBDBDBD)
.withOpacity(0.5),
),
),
Text(
'Living\nRoom',
style: Theme.of(context).textTheme.headline1,
),
],
),
SizedBox(
height: getProportionateScreenHeight(26),
),
Text(
'Power',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(4),
),
Switch.adaptive(
inactiveThumbColor: const Color(0xFFE4E4E4),
inactiveTrackColor: Colors.white,
activeColor: Colors.white,
activeTrackColor: const Color(0xFF464646),
value: model.isLightOff,
onChanged: (value) {
model.lightSwitch(value);
},
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Text(
'Color',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(7),
),
InkWell(
onTap: model.showColorPanel,
child: Image.asset(
'assets/images/color_wheel.png',
height: getProportionateScreenHeight(22),
),
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(40),
),
],
),
),
Column(
children: [
Image.asset(
'assets/images/lamp.png',
height: getProportionateScreenHeight(180),
width: getProportionateScreenWidth(140),
fit: BoxFit.contain,
),
///todo: Position this image in correct manner
model.isLightOff
? Image.asset(
model.lightImage,
height: getProportionateScreenHeight(190),
width: getProportionateScreenWidth(140),
fit: BoxFit.contain,
alignment: Alignment.topCenter,
)
: SizedBox(
height: getProportionateScreenHeight(190),
width: getProportionateScreenWidth(140),
),
],
),
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(
15,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Tone Glow',
style: Theme.of(context).textTheme.headline2,
),
SizedBox(
height: getProportionateScreenHeight(9),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: ToggleButtons(
selectedColor: Colors.white,
fillColor: const Color(0xFF464646),
renderBorder: false,
borderRadius: BorderRadius.circular(15),
textStyle: Theme.of(context)
.textTheme
.headline2!
.copyWith(color: Colors.white),
children: <Widget>[
SizedBox(
width: getProportionateScreenWidth(115),
child: const Text(
'Warm',
textAlign: TextAlign.center,
),
),
SizedBox(
width: getProportionateScreenWidth(115),
child: const Text(
'Cold',
textAlign: TextAlign.center,
),
),
],
onPressed: (int index) {
model.onToggleTapped(index);
},
isSelected: model.isSelected,
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Intensity',
style: Theme.of(context).textTheme.headline2,
),
Text(
'${model.lightIntensity.toInt()}%',
style: Theme.of(context).textTheme.headline2,
),
],
),
SliderTheme(
data: SliderThemeData(
trackHeight: getProportionateScreenHeight(5),
thumbColor: const Color(0xFF464646),
activeTrackColor: const Color(0xFF464646),
inactiveTrackColor: Colors.white,
thumbShape:
const RoundSliderThumbShape(enabledThumbRadius: 8)),
child: Slider(
min: 0,
max: 100,
onChanged: (val) {
model.changeLightIntensity(val);
},
value: model.lightIntensity,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Off',
style: Theme.of(context).textTheme.bodyText1,
),
Text(
'100%',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
],
),
),
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/smart_light | mirrored_repositories/smart-home-app/lib/src/screens/smart_light/components/date_container.dart | import 'package:domus/config/size_config.dart';
import 'package:flutter/material.dart';
class DateContainer extends StatelessWidget {
const DateContainer({
Key? key,
required this.date,
required this.day,
required this.active,
}) : super(key: key);
final String date;
final String day;
final bool active;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: getProportionateScreenHeight(70),
width: getProportionateScreenWidth(65),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: active ? const Color(0xFF464646) : Colors.white,
border: Border.all(
color: active ? const Color(0xFF464646) : const Color(0xFFBDBDBD),
width: 2,
),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Center(
child: Text(
' $date\n$day',
style: Theme.of(context).textTheme.headline2!.copyWith(
color: active ? Colors.white : const Color(0xFFBDBDBD),
),
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/login_screen/login_screen.dart | import 'package:domus/src/screens/login_screen/components/body.dart';
import 'package:flutter/material.dart';
class LoginScreen extends StatelessWidget {
static String routeName = '/login-screen';
const LoginScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
resizeToAvoidBottomInset:false,
body: Body(),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/login_screen | mirrored_repositories/smart-home-app/lib/src/screens/login_screen/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/home_screen/home_screen.dart';
import 'package:flutter/material.dart';
class Body extends StatelessWidget {
const Body({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Image.asset('assets/images/login.png',
height: getProportionateScreenHeight(300),
width: double.infinity,
fit: BoxFit.fill,),
Positioned(
bottom: getProportionateScreenHeight(20),
left: getProportionateScreenWidth(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('SMART',style: Theme.of(context).textTheme.headline2!.copyWith(color: Colors.black, fontSize: 33),),
Text('HOME', style: Theme.of(context).textTheme.headline1!.copyWith(color: Colors.black, fontSize: 64),)
],
)),
],
),
const Padding(
padding: EdgeInsets.all(20.0),
child: Text('sign into \nmange your device & accessory',style: TextStyle(fontSize: 18),),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
child: TextField(
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(left: 40.0, right: 20.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(70.0),),
hintText: 'Email',
suffixIcon: const Icon(Icons.email, color: Colors.black,)
),),
),
SizedBox(height: getProportionateScreenHeight(20)),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
child: TextField(
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(left: 40.0, right: 20.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(70.0),),
hintText: 'Password',
suffixIcon: const Icon(Icons.lock, color: Colors.black,)
),),
),
SizedBox(height: getProportionateScreenHeight(20)),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: GestureDetector(
onTap: (){
Navigator.of(context).pushReplacementNamed(HomeScreen.routeName);
},
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(16.0),
decoration:BoxDecoration(
color: const Color(0xFF464646),
borderRadius:BorderRadius.circular(70.0), ),
child: const Text('Get Started', style: TextStyle(color: Colors.white),),alignment: Alignment.center,),
),
),
SizedBox(height: getProportionateScreenHeight(10)),
const Center(child: Text('Don\'t have an account yet?'))
],
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens | mirrored_repositories/smart-home-app/lib/src/screens/edit_profile/edit_profile.dart | import 'package:domus/src/screens/edit_profile/components/body.dart';
import 'package:flutter/material.dart';
class EditProfile extends StatelessWidget {
static String routeName = '/edit-profile';
const EditProfile({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: const Scaffold(
backgroundColor: Color(0xFFF2F2F2),
body: Body(),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/edit_profile | mirrored_repositories/smart-home-app/lib/src/screens/edit_profile/components/image_picker.dart | import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
class UploadImage extends StatefulWidget {
const UploadImage({Key? key}) : super(key: key);
@override
_UploadImageState createState() => _UploadImageState();
}
class _UploadImageState extends State<UploadImage> {
File? _image;
final ImagePicker _picker = ImagePicker();
// Future getImageFromCamera() async {
// var image = await _picker.pickImage(source: ImageSource.camera);
// setState(() {
// imagePath = image as File?;
// });
// }
Future getImageFromGallery() async {
var image = await _picker.pickImage(source: ImageSource.gallery);
setState(() {
_image = File(image!.path);
});
}
@override
Widget build(BuildContext context) {
return Container(
height: 70,
width: 70,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(spreadRadius: 6, color: Colors.black38),
]),
child: _image == null
? IconButton(
icon: const Icon(
Icons.upload_rounded,
color: Colors.white,
size: 30,
),
onPressed: () {
getImageFromGallery();
// Save Image to some storage
},
)
: InkWell(
onTap: () {
getImageFromGallery();
},
child: ClipRRect(
child: Image.file(
_image!,
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(35),
),
),
);
}
}
| 0 |
mirrored_repositories/smart-home-app/lib/src/screens/edit_profile | mirrored_repositories/smart-home-app/lib/src/screens/edit_profile/components/body.dart | import 'package:domus/config/size_config.dart';
import 'package:domus/src/screens/edit_profile/components/image_picker.dart';
import 'package:flutter/material.dart';
import 'package:dotted_border/dotted_border.dart';
class Body extends StatefulWidget {
const Body({Key? key}) : super(key: key);
@override
State<Body> createState() => _BodyState();
}
class _BodyState extends State<Body> {
TextEditingController nameController = TextEditingController();
TextEditingController usernameController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController phoneController = TextEditingController();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(
left: getProportionateScreenWidth(20),
// top: getProportionateScreenHeight(15),
right: getProportionateScreenWidth(20),
bottom: getProportionateScreenHeight(15),
),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: getProportionateScreenHeight(40),
),
Padding(
padding: const EdgeInsets.only(left: 7, right: 7),
child: Row(
children: [
const Text(
'Edit Profile',
// style: Theme.of(context).textTheme.headline1,
style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold),
),
const Spacer(),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(
Icons.close,
size: 35,
),
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(25),
),
Center(
child: Container(
width: 350,
decoration: BoxDecoration(
color: const Color(0xFFBDBDBD).withOpacity(0.1),
borderRadius: BorderRadius.circular(30),
),
padding: EdgeInsets.only(
left: getProportionateScreenWidth(15),
top: getProportionateScreenHeight(15),
right: getProportionateScreenWidth(15),
bottom: getProportionateScreenHeight(40),
),
child: Column(
children: [
const Text(
'Upload image',
// style: Theme.of(context).textTheme.headline1,
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
SizedBox(
height: getProportionateScreenHeight(15),
),
DottedBorder(
borderType: BorderType.RRect,
radius: const Radius.circular(20),
dashPattern: const [7, 7],
color: Colors.black38,
strokeWidth: 2,
// padding: EdgeInsets.fromLTRB(115, 37, 115, 37),
padding: EdgeInsets.fromLTRB(
getProportionateScreenWidth(75),
getProportionateScreenHeight(25),
getProportionateScreenWidth(75),
getProportionateScreenHeight(25)),
child: const UploadImage(),
)
],
),
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Form(
key: _formKey,
child: Column(
children: [
TextFormField(
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: nameController,
autofocus: false,
textCapitalization: TextCapitalization.words,
validator: (value) {
if (value!.isEmpty || value.trim().isEmpty) {
return 'Name is required';
}
return null;
},
cursorColor: Colors.black12,
decoration: InputDecoration(
hintText: 'Your full name',
hintStyle: const TextStyle(color: Colors.grey),
icon: Container(
height: 50,
width: 40,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(15),
),
child: const Icon(
Icons.person,
color: Colors.white,
),
),
// prefixIcon: Icon(Icons.person, size: 25, color: Colors.grey,),
// contentPadding: EdgeInsets.only(left: 30),
border: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
enabled: true,
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
errorBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
TextFormField(
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: usernameController,
autofocus: false,
keyboardType: TextInputType.text,
validator: (value){
if(value!.isEmpty || value.trim().isEmpty){
return 'Username is required';
}
return null;
},
cursorColor: Colors.black12,
decoration: InputDecoration(
hintText: 'Username',
hintStyle: const TextStyle(color: Colors.grey),
icon: Container(
height: 50,
width: 40,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(15),
),
child: const Icon(
Icons.person,
color: Colors.white,
),
),
border: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
enabled: true,
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
errorBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
TextFormField(
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: emailController,
autofocus: false,
keyboardType: TextInputType.emailAddress,
validator: (value){
if(value!.isEmpty || value.trim().isEmpty){
return 'Email is required';
}
return null;
},
cursorColor: Colors.black12,
decoration: InputDecoration(
hintText: 'Your Email',
hintStyle: const TextStyle(color: Colors.grey),
icon: Container(
height: 50,
width: 40,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(15),
),
child: const Icon(
Icons.person,
color: Colors.white,
),
),
border: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
enabled: true,
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
errorBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
TextFormField(
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: phoneController,
autofocus: false,
keyboardType: TextInputType.number,
validator: (value) {
if(value!.isEmpty || value.trim().isEmpty) {
return 'Phone no. is required';
}
return null;
},
cursorColor: Colors.black12,
decoration: InputDecoration(
hintText: 'Your Phone',
hintStyle: const TextStyle(color: Colors.grey),
icon: Container(
height: 50,
width: 40,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(15),
),
child: const Icon(
Icons.person,
color: Colors.white,
),
),
border: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
enabled: true,
enabledBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black38),
),
focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
errorBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
),
),
],
),
),
SizedBox(
height: getProportionateScreenHeight(20),
),
Container(
height: getProportionateScreenHeight(40),
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(20),
),
child: const Center(
child: Text('Save Changes', style: TextStyle(fontSize: 18, color: Colors.white70, fontWeight: FontWeight.bold),)
),
),
],
),
);
}
}
| 0 |
Subsets and Splits