Skip to content

Commit

Permalink
location page is created.
Browse files Browse the repository at this point in the history
  • Loading branch information
sonerxdev committed Sep 29, 2021
1 parent 5c3d0df commit 4bc6508
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 68 deletions.
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.animation_library">
<uses-permission android:name="android.permission.INTERNET"/>
<application

android:label="animation_library"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion lib/core/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const kPrimaryLightColor = Color(0xFFc0cfe2);

const fifthColor = Color(0Xff8D8EEC);
const thirdColor = Color(0Xff4C4AED);

const darkBackgroundColor = Color(0xff353232);
const textColor = Color(0xff3c95fd);
const mainColor = Color(0xff131F2D);
const secondColor = Color(0xff5ABD8C);
Expand Down
17 changes: 1 addition & 16 deletions lib/smartCarApp/battery_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class _BatteryPageState extends State<BatteryPage> {
),
SizedBox(height: context.dynamicHeight(0.01)),
Container(
height: context.dynamicHeight(0.4),
height: context.dynamicHeight(0.3),
width: context.dynamicWidth(0.8),
child: LineChartSample2(),
),
Expand All @@ -129,22 +129,7 @@ class _BatteryPageState extends State<BatteryPage> {
decoration: boxDecoration(),
child: Column(
children: [
Text(
"Range",
style: GoogleFonts.yantramanav(
textStyle: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.w400,
),
),
),
SizedBox(
height: context.dynamicHeight(0.03),
),
Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.end,
children: [
Column(
children: [
Expand Down
64 changes: 35 additions & 29 deletions lib/smartCarApp/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:animation_library/smartCarApp/home_page.dart';
import 'package:animation_library/smartCarApp/battery_page.dart';
import 'package:animation_library/smartCarApp/models/home_controller.dart';
import 'package:animation_library/smartCarApp/profile_page.dart';
import 'package:animation_library/smartCarApp/settings_page.dart';
import 'package:animation_library/smartCarApp/location_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -45,36 +45,42 @@ class _BottomNavigationBarPageState extends State<BottomNavigationBarPage> {
Widget build(BuildContext context) {
final _homeController = Provider.of<HomeController>(context);
return Scaffold(
// backgroundColor: Colors.black87,
bottomNavigationBar: Container(
decoration: boxDecoration(),
margin: const EdgeInsets.all(12.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(40.0),
child: BottomNavigationBar(
unselectedItemColor: Colors.black87,
selectedItemColor: textColor,
type: BottomNavigationBarType.shifting,
items: const [
BottomNavigationBarItem(
icon: Icon(
Icons.home_outlined,
),
label: 'Home',
backgroundColor:
_selectedIndex == 2 ? Colors.black87.withOpacity(0.4) : Colors.white,
bottomNavigationBar: Stack(
children: [
Container(
decoration: boxDecoration(),
margin: const EdgeInsets.all(12.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(40.0),
child: BottomNavigationBar(
unselectedItemColor: Colors.white,
selectedItemColor: textColor,
backgroundColor: darkBackgroundColor,
type: BottomNavigationBarType.fixed,
items: const [
BottomNavigationBarItem(
icon: Icon(
Icons.home_outlined,
),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.battery_charging_full_outlined),
label: 'Charge',
),
BottomNavigationBarItem(
icon: Icon(Icons.location_on_outlined),
label: 'Location',
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
BottomNavigationBarItem(
icon: Icon(Icons.battery_charging_full_outlined),
label: 'Charge',
),
BottomNavigationBarItem(
icon: Icon(Icons.location_on_outlined),
label: 'Location',
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
),
),
],
),
body: SizedBox.expand(
child: PageView(
Expand Down
6 changes: 3 additions & 3 deletions lib/smartCarApp/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _HomePageState extends State<HomePage> {
height: context.dynamicHeight(0.07),
width: context.dynamicWidth(0.35),
decoration: BoxDecoration(
color: Colors.black87,
color: darkBackgroundColor,
borderRadius: BorderRadius.circular(40),
),
child: Row(
Expand Down Expand Up @@ -56,7 +56,7 @@ class _HomePageState extends State<HomePage> {
child: CircleAvatar(
child: Padding(
padding: EdgeInsets.only(
left: context.dynamicWidth(0.1),
left: context.dynamicWidth(0.07),
bottom: context.dynamicHeight(0.1),
),
child: Icon(
Expand Down Expand Up @@ -344,7 +344,7 @@ class _HomePageState extends State<HomePage> {

BoxDecoration boxDecoration() {
return BoxDecoration(
color: Colors.black87,
color: darkBackgroundColor,
borderRadius: BorderRadius.circular(10.0),
);
}
150 changes: 150 additions & 0 deletions lib/smartCarApp/location_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import 'package:animation_library/core/base_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:latlong2/latlong.dart';

const MAPBOX_STYLE = 'mapbox/dark-v10';
const MAPBOX_ACCESS_TOKEN =
'sk.eyJ1Ijoic29uZXI5NyIsImEiOiJja3U0ajUwazUxZjBlMm9vMWtodjljenRjIn0.UUKmqd02IHi3eo93II8m-Q';

const MARKER_COLOR = Color(0xff3dc5a7);

final _myLocation = LatLng(
40.944538,
29.115499,
);

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

@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
FlutterMap(
options: MapOptions(
maxZoom: 16,
minZoom: 5,
zoom: 13,
center: _myLocation,
),
nonRotatedLayers: [
TileLayerOptions(
urlTemplate:
'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}',
additionalOptions: {
'accessToken': MAPBOX_ACCESS_TOKEN,
'id': MAPBOX_STYLE
},
),
MarkerLayerOptions(markers: [
Marker(
point: _myLocation,
builder: (_) {
return MyLocationMarker();
},
)
])
],
),
Positioned(
left: 0,
right: 0,
bottom: 50,
height: context.dynamicHeight(0.3),
child: PageView.builder(itemBuilder: (context, index) {
return MapItemDetails();
}),
),
Positioned(
top: context.dynamicHeight(0.0),
left: context.dynamicWidth(0.0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.black87.withOpacity(0.9), Colors.transparent],
),
),
height: context.dynamicHeight(0.1),
width: MediaQuery.of(context).size.width,
),
),
Positioned(
top: context.dynamicHeight(0.04),
left: context.dynamicWidth(0.05),
child: Icon(
Icons.location_on_outlined,
color: Colors.white,
size: 27.0,
),
),
Positioned(
top: context.dynamicHeight(0.03),
right: context.dynamicWidth(0.05),
child: CircleAvatar(
child: Padding(
padding: EdgeInsets.only(
left: context.dynamicWidth(0.07),
bottom: context.dynamicHeight(0.1),
),
child: Icon(
Icons.circle,
color: Colors.red,
size: 16.0,
),
),
backgroundImage: AssetImage(
"assets/images/person.jpg",
),
),
),
Positioned(
top: context.dynamicHeight(0.05),
left: context.dynamicWidth(0.4),
child: Text(
"Location",
style: GoogleFonts.yantramanav(
textStyle: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
),
],
),
);
}
}

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

@override
Widget build(BuildContext context) {
return Container(
height: 50.0,
width: 50.0,
decoration: BoxDecoration(
color: MARKER_COLOR,
shape: BoxShape.circle,
),
);
}
}

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

@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
);
}
}
19 changes: 0 additions & 19 deletions lib/smartCarApp/settings_page.dart

This file was deleted.

0 comments on commit 4bc6508

Please sign in to comment.