-
Notifications
You must be signed in to change notification settings - Fork 2
Lab 4 #6
base: main
Are you sure you want to change the base?
Lab 4 #6
Conversation
Lab 4 felishtan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohnSteck9 @maksymbudzin well done, everything works and all the requirements are met.
10/10 for both of you.
const BottomNavigationBarThemeData(selectedItemColor: Colors.white), | ||
); | ||
|
||
ThemeData secondTheme = ThemeData( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to use secondary
ThemeData get currentTheme => _currentTheme; | ||
|
||
void toggleTheme() { | ||
_currentTheme = _currentTheme == mainTheme ? secondTheme : mainTheme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use something like this instead:
final themes = [primaryTheme, secondaryTheme];
int currentTheme = 0;
Theme get currentTheme => themes[currentTheme];
void toggle() {
currentTheme = (currentTheme + 1) % themes.length;
}
this will allow you to cycle through themes, and adding new themes to themes
array without changing a code inside your toggle
|
||
void generateRandomImage() { | ||
var random = new Random(); | ||
int min = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many variables, just use
var randomIndex = 1 + Random().nextInt(63707306);
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
// var incrementValue = context.watch<Increment>().count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont leave commented blocks of code
} | ||
|
||
class LibraryState extends State<LibraryTab> { | ||
late String temp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use
String newPlaylist = '';
void initState() { | ||
super.initState(); | ||
|
||
playList.addAll(['maks_playlist', 'vika_playlist', 'mykhailo_playlist']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use
List playList = ['maks_playlist', 'vika_playlist', 'mykhailo_playlist'];
when declaring the field
Added Maxim's local state:
This state allows us to add and remove our custom playlists on the library screen by tap on + New playlist
Added Mykhailo's local state:
This state allows us to increase the number of views by tap on them
Added Maxim's global state:
This global state allows us to change the theme of the application on the light and on the dark by tap on the icon in the app bar
Added Mykhailo's global state:
This global state allows us to change the user icon to a random icon from the git hub by tap on the user icon in the user screen