Skip to content

Commit

Permalink
bug fixes in createplaylist sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 25, 2024
1 parent 74e7408 commit 991d096
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 98 deletions.
13 changes: 10 additions & 3 deletions lib/blocs/explore/cubit/explore_cubits.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,16 @@ class FetchChartCubit extends Cubit<FetchChartState> {
.filter()
.chartNameEqualTo(i.title)
.findFirstSync();
if ((chartCacheDB?.lastUpdated.difference(DateTime.now()).inHours ??
24) >
12) {
bool _shouldFetch = (chartCacheDB?.lastUpdated
.difference(DateTime.now())
.inHours
.abs() ??
80) >
16;
log("Last Updated - ${(chartCacheDB?.lastUpdated.difference(DateTime.now()).inHours)?.abs()} Hours before ",
name: "Isolate");

if (_shouldFetch) {
chart = await i.chartFunction(i.url);
if ((chart.chartItems?.isNotEmpty) ?? false) {
db.writeTxnSync(() =>
Expand Down
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:Bloomee/model/youtube_vid_model.dart';
import 'package:Bloomee/repository/Youtube/youtube_api.dart';
import 'package:Bloomee/routes_and_consts/global_str_consts.dart';
import 'package:Bloomee/screens/widgets/snackbar.dart';
import 'package:Bloomee/theme_data/default.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:Bloomee/blocs/add_to_playlist/cubit/add_to_playlist_cubit.dart';
Expand Down Expand Up @@ -208,6 +209,7 @@ class _MyAppState extends State<MyApp> {
return MaterialApp.router(
scaffoldMessengerKey: SnackbarService.messengerKey,
routerConfig: GlobalRoutes.globalRouter,
theme: Default_Theme().defaultThemeData,
);
}
},
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/screen/add_to_playlist_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class _AddToPlaylistScreenState extends State<AddToPlaylistScreen> {
),
),
body: Column(
mainAxisSize: MainAxisSize.min,
children: [
BlocBuilder<AddToPlaylistCubit, AddToPlaylistState>(
builder: (context, state) {
Expand Down Expand Up @@ -99,6 +100,7 @@ class _AddToPlaylistScreenState extends State<AddToPlaylistScreen> {
),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
Expand Down
167 changes: 88 additions & 79 deletions lib/screens/widgets/createPlaylist_bottomsheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,91 +16,100 @@ void createPlaylistBottomSheet(BuildContext context) {
elevation: 20,
backgroundColor: Colors.transparent,
builder: (context) {
return ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(40), topRight: Radius.circular(40)),
child: Container(
height: (MediaQuery.of(context).size.height * 0.45) + 10,
color: Default_Theme.accentColor2,
child: Column(
children: [
const Spacer(),
SizedBox(
height: MediaQuery.of(context).size.height * 0.45,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(42),
topRight: Radius.circular(42)),
child: Container(
color: Default_Theme.themeColor,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(
left: 10, right: 10, bottom: 30),
child: Text(
"Create new Playlist 😍",
style: Default_Theme.secondoryTextStyleMedium
.merge(const TextStyle(
color: Default_Theme.accentColor2,
fontSize: 35)),
return Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(40), topRight: Radius.circular(40)),
child: Container(
height: (MediaQuery.of(context).size.height * 0.45) + 10,
color: Default_Theme.accentColor2,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Spacer(),
SizedBox(
height: MediaQuery.of(context).size.height * 0.45,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(42),
topRight: Radius.circular(42)),
child: Container(
color: Default_Theme.themeColor,
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(
left: 10, right: 10, bottom: 30),
child: Text(
"Create new Playlist 😍",
style: Default_Theme.secondoryTextStyleMedium
.merge(const TextStyle(
color: Default_Theme.accentColor2,
fontSize: 35)),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10),
child: TextField(
autofocus: true,
textInputAction: TextInputAction.done,
maxLines: 3,
textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.center,
focusNode: _focusNode,
cursorHeight: 50,
showCursor: true,
cursorWidth: 5,
cursorRadius: const Radius.circular(5),
cursorColor: Default_Theme.accentColor2,
style: const TextStyle(
fontSize: 45,
color: Default_Theme.accentColor2)
.merge(
Default_Theme.secondoryTextStyleMedium),
decoration: const InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(style: BorderStyle.none),
// borderRadius: BorderRadius.circular(50)
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide.none,
// borderRadius: BorderRadius.circular(50),
)),
onTapOutside: (event) {
_focusNode.unfocus();
},
onSubmitted: (value) {
_focusNode.unfocus();
print(value);
if (value.isNotEmpty && value.length > 2) {
context
.read<BloomeeDBCubit>()
.addNewPlaylistToDB(
MediaPlaylistDB(playlistName: value));
context.pop();
}
},
Padding(
padding: const EdgeInsets.only(
left: 10,
right: 10,
top: 10,
),
child: TextField(
autofocus: true,
textInputAction: TextInputAction.done,
maxLines: 3,
textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.center,
focusNode: _focusNode,
cursorHeight: 60,
showCursor: true,
cursorWidth: 5,
cursorRadius: const Radius.circular(5),
cursorColor: Default_Theme.accentColor2,
style: const TextStyle(
fontSize: 45,
color: Default_Theme.accentColor2)
.merge(
Default_Theme.secondoryTextStyleMedium),
decoration: const InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(style: BorderStyle.none),
// borderRadius: BorderRadius.circular(50)
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide.none,
// borderRadius: BorderRadius.circular(50),
)),
onTapOutside: (event) {
_focusNode.unfocus();
},
onSubmitted: (value) {
_focusNode.unfocus();

if (value.isNotEmpty && value.length > 2) {
context
.read<BloomeeDBCubit>()
.addNewPlaylistToDB(MediaPlaylistDB(
playlistName: value));
context.pop();
}
},
),
),
),
],
],
),
),
),
),
),
),
],
],
),
),
),
);
Expand Down
35 changes: 19 additions & 16 deletions lib/theme_data/default.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ class Default_Theme {
static const successColor = Color(0xFF5EFF43);

ThemeData defaultThemeData = ThemeData(
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
primaryColor: themeColor,
hintColor: themeColor,
inputDecorationTheme: InputDecorationTheme(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(style: BorderStyle.none),
borderRadius: BorderRadius.circular(50)),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Default_Theme.primaryColor1.withOpacity(0.7)),
borderRadius: BorderRadius.circular(50)),
scaffoldBackgroundColor: themeColor,
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: accentColor2,
secondary: accentColor1,
background: themeColor,
brightness: Brightness.dark,
),
iconTheme: const IconThemeData(color: primaryColor1),
appBarTheme: const AppBarTheme(
backgroundColor: themeColor,
// elevation: 0,
iconTheme: IconThemeData(color: primaryColor1),
),
progressIndicatorTheme:
const ProgressIndicatorThemeData(color: accentColor2),
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.white,
selectionColor: accentColor2,
selectionHandleColor: accentColor2,
),
primaryTextTheme: const TextTheme(
titleLarge: primaryTextStyle,
bodyMedium: secondoryTextStyleMedium,
bodySmall: tertiaryTextStyle,
titleMedium: secondoryTextStyle),
);
}

0 comments on commit 991d096

Please sign in to comment.