Skip to content

Commit

Permalink
navbar + yoga card improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Khattar committed Dec 27, 2023
1 parent ef7c4ee commit 7df5e05
Show file tree
Hide file tree
Showing 8 changed files with 454 additions and 318 deletions.
114 changes: 57 additions & 57 deletions lib/components/hexagon.dart
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
import 'package:flutter/material.dart';
import 'package:yogzen/global/color.dart';
import 'package:yogzen/openAI/open_AI.dart';
// import 'package:flutter/material.dart';
// import 'package:yogzen/global/color.dart';
// import 'package:yogzen/openAI/open_AI.dart';


class HexagonClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final path = Path();
// class HexagonClipper extends CustomClipper<Path> {
// @override
// Path getClip(Size size) {
// final path = Path();

double h = size.height;
double w = size.width;
// double h = size.height;
// double w = size.width;

path.moveTo(w / 2, 0);
path.lineTo(w, h / 4);
path.lineTo(w, 3 * h / 4);
path.lineTo(w / 2, h);
path.lineTo(0, 3 * h / 4);
path.lineTo(0, h / 4);
path.close();
// path.moveTo(w / 2, 0);
// path.lineTo(w, h / 4);
// path.lineTo(w, 3 * h / 4);
// path.lineTo(w / 2, h);
// path.lineTo(0, 3 * h / 4);
// path.lineTo(0, h / 4);
// path.close();

return path;
}
// return path;
// }

@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
// @override
// bool shouldReclip(CustomClipper<Path> oldClipper) {
// return false;
// }
// }

class HexagonWidget extends StatelessWidget {
// final ImagePicker _picker = ImagePicker();
// Future<void> _openCamera() async {
// final pickedFile = await _picker.pickImage(source: ImageSource.camera);
// }
// class HexagonWidget extends StatelessWidget {
// // final ImagePicker _picker = ImagePicker();
// // Future<void> _openCamera() async {
// // final pickedFile = await _picker.pickImage(source: ImageSource.camera);
// // }

@override
Widget build(BuildContext context) {
return ClipPath(
clipper: HexagonClipper(),
child: Container(
decoration: BoxDecoration(
color: kdarkBlue,
boxShadow: [
const BoxShadow(
offset: Offset(0, 4), blurRadius: 4, color: Colors.black12),
],
),
height: 68, // Set the height of your hexagon here
child: IconButton(
// onPressed: () async {
// List<String> l= await fetchYogaPose("TadaAsan");
// print(l);
// },
onPressed: () {
// @override
// Widget build(BuildContext context) {
// return ClipPath(
// clipper: HexagonClipper(),
// child: Container(
// decoration: BoxDecoration(
// color: kdarkBlue,
// boxShadow: [
// const BoxShadow(
// offset: Offset(0, 4), blurRadius: 4, color: Colors.black12),
// ],
// ),
// height: 68, // Set the height of your hexagon here
// child: IconButton(
// // onPressed: () async {
// // List<String> l= await fetchYogaPose("TadaAsan");
// // print(l);
// // },
// onPressed: () {

},
icon: const Icon(
Icons.camera,
color: Colors.white,
),
),
),
);
}
}
// },
// icon: const Icon(
// Icons.camera,
// color: Colors.white,
// ),
// ),
// ),
// );
// }
// }
167 changes: 81 additions & 86 deletions lib/components/nav_bar.dart
Original file line number Diff line number Diff line change
@@ -1,90 +1,85 @@
import 'package:flutter/material.dart';
// import 'package:flutter/material.dart';

import '../../global/color.dart';
import './hexagon.dart';
// import '../../global/color.dart';
// import './hexagon.dart';

class NavBar extends StatefulWidget {
final int idx;
final Function change;
const NavBar({
Key? key,
required this.idx,
required this.change,
}) : super(key: key);
// class NavBar extends StatefulWidget {
// final int idx;
// final Function change;
// const NavBar({
// Key? key,
// required this.idx,
// required this.change,
// }) : super(key: key);

@override
State<NavBar> createState() => _NavBarState();
}
// @override
// State<NavBar> createState() => _NavBarState();
// }

class _NavBarState extends State<NavBar> {
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
return Stack(
clipBehavior: Clip.none,
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
blurRadius: 10,
offset: Offset(2, -4),
color: Colors.black12,
),
],
),
width: width,
padding: EdgeInsets.fromLTRB(16, 4, 16, 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
IconButton(
onPressed: () => widget.change(0),
icon: Icon(
Icons.home_rounded,
size: 30,
color: widget.idx == 0
? kdarkBlue
: kblackSubHeading.withOpacity(0.3),
),
),
SizedBox(
width: 60,
),
IconButton(
onPressed: () => widget.change(1),
icon: Icon(
Icons.health_and_safety,
size: 30,
color: widget.idx == 1
? kdarkBlue
: kblackSubHeading.withOpacity(0.3),
),
),
SizedBox(
width: 60,
),
IconButton(
onPressed: () => widget.change(2),
icon: Icon(
Icons.person,
size: 30,
color: widget.idx == 2
? kdarkBlue
: kblackSubHeading.withOpacity(0.3),
),
),
],
),
),
// Positioned(
// child: HexagonWidget(),
// top: -30,
// left: width / 2 - 30,
// right: width / 2 - 30,
// )
],
);
}
}
// class _NavBarState extends State<NavBar> {
// @override
// Widget build(BuildContext context) {
// final width = MediaQuery.of(context).size.width;
// return Stack(
// clipBehavior: Clip.none,
// children: [
// Container(
// decoration: BoxDecoration(
// color: Colors.white,
// boxShadow: [
// BoxShadow(
// blurRadius: 10,
// offset: Offset(2, -4),
// color: Colors.black12,
// ),
// ],
// ),
// width: width,
// padding: EdgeInsets.fromLTRB(16, 4, 16, 8),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// IconButton(
// onPressed: () => widget.change(0),
// icon: Icon(
// Icons.home_rounded,
// size: 30,
// color: widget.idx == 0
// ? kdarkBlue
// : kblackSubHeading.withOpacity(0.3),
// ),
// ),
// SizedBox(
// width: 60,
// ),
// IconButton(
// onPressed: () => widget.change(1),
// icon: Icon(
// Icons.health_and_safety,
// size: 30,
// color: widget.idx == 1
// ? kdarkBlue
// : kblackSubHeading.withOpacity(0.3),
// ),
// ),
// SizedBox(
// width: 60,
// ),
// IconButton(
// onPressed: () => widget.change(2),
// icon: Icon(
// Icons.person,
// size: 30,
// color: widget.idx == 2
// ? kdarkBlue
// : kblackSubHeading.withOpacity(0.3),
// ),
// ),
// ],
// ),
// ),

// ],
// );
// }
// }
56 changes: 55 additions & 1 deletion lib/components/nav_bar_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:bottom_navy_bar/bottom_navy_bar.dart';
import 'package:flutter/material.dart';
import 'package:yogzen/components/nav_bar.dart';
import 'package:yogzen/global/color.dart';
import 'package:yogzen/screens/home/home_screen.dart';
import 'package:yogzen/screens/specific_needs/specific_needs.dart';
import 'package:yogzen/screens/userprofile/user_profile.dart';
Expand Down Expand Up @@ -30,8 +32,60 @@ class _NavScreenState extends State<NavScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: NavBar(idx: _selected, change: _changeScreen),
body: _pages[_selected],
bottomNavigationBar: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: BottomNavyBar(
backgroundColor: Colors.white,
showElevation: false,
items: [
BottomNavyBarItem(
title: Text(
"Home",
style: TextStyle(
color: kblackHeading,
),
),
icon: SizedBox(
child: Icon(
Icons.home,
color: kblackHeading,
),
),
),
BottomNavyBarItem(
title: Text(
"Health",
style: TextStyle(
color: kblackHeading,
),
),
icon: SizedBox(
child: Icon(
Icons.health_and_safety,
color: kblackHeading,
),
),
),
BottomNavyBarItem(
title: Text(
"Profile",
style: TextStyle(
color: kblackHeading,
),
),
icon: SizedBox(
child: Icon(
Icons.person,
color: kblackHeading,
),
),
),
],
selectedIndex: _selected,
onItemSelected: _changeScreen,
),
),
);
}
}
Loading

0 comments on commit 7df5e05

Please sign in to comment.