updated iconpicker

This commit is contained in:
2022-11-18 14:51:47 -05:00
parent 4cfffa59f9
commit 7e6ccf67a2
7 changed files with 75 additions and 9 deletions

View File

@@ -8,15 +8,17 @@ import 'package:dash/utils/dbhelper_sqflite.dart';
import 'package:dash/models/car.dart'; import 'package:dash/models/car.dart';
import 'package:dash/models/txn.dart'; import 'package:dash/models/txn.dart';
import 'package:dash/screens/screens.dart'; import 'package:dash/screens/screens.dart';
import 'package:dash/theme.dart';
// import 'package:flutter/src/widgets/form.dart'; // import 'package:flutter/src/widgets/form.dart';
void main() async { void main() async {
runApp( runApp(
ChangeNotifierProvider( ChangeNotifierProvider(
create: (context) => GarageModel(), create: (context) => GarageModel(),
child: const MaterialApp( child: MaterialApp(
title: 'Dashboard', title: 'Dashboard',
home: MyApp(), home: MyApp(),
theme: appTheme,
/* initialRoute: '/', /* initialRoute: '/',
routes: { routes: {
'/': (context) => const MyApp(), '/': (context) => const MyApp(),

View File

@@ -5,6 +5,7 @@ import 'package:dash/utils/garage_model.dart';
// import 'package:dash/main.dart'; // import 'package:dash/main.dart';
import 'package:dash/models/car.dart'; import 'package:dash/models/car.dart';
import 'package:dash/screens/screens.dart'; import 'package:dash/screens/screens.dart';
import 'package:google_fonts/google_fonts.dart';
class CarDetailScreen extends StatefulWidget { class CarDetailScreen extends StatefulWidget {
const CarDetailScreen({super.key, required this.carIndex}); const CarDetailScreen({super.key, required this.carIndex});
@@ -38,7 +39,7 @@ class _CarDetailScreenState extends State<CarDetailScreen> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Center( Center(
// edit car screen // edit car
child: Ink( child: Ink(
decoration: const ShapeDecoration( decoration: const ShapeDecoration(
color: Colors.lightBlue, shape: CircleBorder()), color: Colors.lightBlue, shape: CircleBorder()),
@@ -61,8 +62,19 @@ class _CarDetailScreenState extends State<CarDetailScreen> {
Consumer<GarageModel>( Consumer<GarageModel>(
builder: (context, garage, child) => Column( builder: (context, garage, child) => Column(
children: [ children: [
Text("Nickname: ${garage.cars[widget.carIndex].nickname}"), Row(
Text("VIN: ${garage.cars[widget.carIndex].vin}"), mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text("${garage.cars[widget.carIndex].nickname}"),
]),
Text(
"Nickname: ${garage.cars[widget.carIndex].nickname}",
style: GoogleFonts.crimsonPro(),
),
Text(
"VIN: ${garage.cars[widget.carIndex].vin}",
style: GoogleFonts.crimsonPro(),
),
Text("License Plate: ${garage.cars[widget.carIndex].plate}"), Text("License Plate: ${garage.cars[widget.carIndex].plate}"),
Text( Text(
"Mileage: ${garage.cars[widget.carIndex].mileage.toString()}"), "Mileage: ${garage.cars[widget.carIndex].mileage.toString()}"),

View File

@@ -105,7 +105,10 @@ class _EditCarScreenState extends State<EditCarScreen> {
leading: CircleAvatar( leading: CircleAvatar(
backgroundImage: AssetImage(car.icon ?? selectedIcon), backgroundImage: AssetImage(car.icon ?? selectedIcon),
backgroundColor: Colors.white), backgroundColor: Colors.white),
title: const Text("Change Icon"), title: Text(
"Change Icon",
style: TextStyle(color: Colors.grey[700], fontSize: 14),
),
onTap: () => showDialog( onTap: () => showDialog(
barrierColor: Colors.black.withOpacity(.5), barrierColor: Colors.black.withOpacity(.5),
context: context, context: context,
@@ -113,7 +116,6 @@ class _EditCarScreenState extends State<EditCarScreen> {
return ip; return ip;
}).then((value) => setState( }).then((value) => setState(
() { () {
// selectedIcon = ip.selectedIcon;
selectedIcon = value; selectedIcon = value;
}, },
))), ))),

View File

@@ -86,7 +86,10 @@ class _NewCarScreenState extends State<NewCarScreen> {
leading: CircleAvatar( leading: CircleAvatar(
backgroundImage: AssetImage(selectedIcon), backgroundImage: AssetImage(selectedIcon),
backgroundColor: Colors.white), backgroundColor: Colors.white),
title: const Text("Change Icon"), title: Text(
"Change Icon",
style: TextStyle(color: Colors.grey[700], fontSize: 14),
),
onTap: () => showDialog( onTap: () => showDialog(
barrierColor: Colors.black.withOpacity(.5), barrierColor: Colors.black.withOpacity(.5),
context: context, context: context,

12
lib/theme.dart Normal file
View File

@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
var appTheme = ThemeData(
brightness: Brightness.light,
// textTheme: const TextTheme(
// bodyText1: TextStyle(fontSize: 18),
// button: TextStyle(
// letterSpacing: 1.5,
// fontWeight: FontWeight.bold,
// ),
// ),
);

View File

@@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0" version: "1.16.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -81,6 +88,27 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.5"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@@ -268,6 +296,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.12" version: "0.4.12"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:

View File

@@ -1,5 +1,5 @@
name: dash name: dash
description: A new Flutter project. description: Keep track of your car stuff.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
@@ -36,7 +36,7 @@ dependencies:
sqflite: any sqflite: any
path: path:
path_provider: ^2.0.11 path_provider: ^2.0.11
google_fonts: ^3.0.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.