Created
December 1, 2023 20:34
-
-
Save davidmigloz/d815266901bca5c0a3a00381924bc417 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData.dark().copyWith( | |
useMaterial3: true, | |
), | |
home: YouTubeHomePage(), | |
); | |
} | |
} | |
class YouTubeHomePage extends StatefulWidget { | |
@override | |
_YouTubeHomePageState createState() => _YouTubeHomePageState(); | |
} | |
class _YouTubeHomePageState extends State<YouTubeHomePage> { | |
int _selectedIndex = 0; | |
static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold); | |
static List<Widget> _widgetOptions = <Widget>[ | |
Text( | |
'Home', | |
style: optionStyle, | |
), | |
Text( | |
'Shorts', | |
style: optionStyle, | |
), | |
Text( | |
'Add', | |
style: optionStyle, | |
), | |
Text( | |
'Subscriptions', | |
style: optionStyle, | |
), | |
Text( | |
'Library', | |
style: optionStyle, | |
), | |
]; | |
void _onItemTapped(int index) { | |
setState(() { | |
_selectedIndex = index; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Image.network( | |
'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-dtDDtkEGoFccn5xaP5W1p3Rr%2Fuser-3XZA7QXb1LF8ADMIxEZC0Qp4%2Fimg-f3F1CchwZM3gIz1MFh181hgv.png%3Fst%3D2023-12-01T19%253A34%253A41Z%26se%3D2023-12-01T21%253A34%253A41Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2023-11-30T23%253A25%253A28Z%26ske%3D2023-12-01T23%253A25%253A28Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DhPSV0LqyWFatOLztb4SjDeVJcwQINtAotnC4gSEGZLI%253D', | |
height: 20.0, | |
), | |
actions: [ | |
IconButton( | |
icon: Icon(Icons.cast), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.notifications_none), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.search), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.account_circle), | |
onPressed: () {}, | |
), | |
], | |
), | |
body: ListView( | |
children: [ | |
_videoItem( | |
'RISKIEST Mountain Bike Ride of My Life 1000ft Drop', | |
'WOLFPACK ADVENTURES - 5M views - 4 months ago', | |
'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-dtDDtkEGoFccn5xaP5W1p3Rr%2Fuser-3XZA7QXb1LF8ADMIxEZC0Qp4%2Fimg-FOiEZAuEr0GM1O90oudwY9fI.png%3Fst%3D2023-12-01T19%253A34%253A44Z%26se%3D2023-12-01T21%253A34%253A44Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2023-11-30T23%253A14%253A34Z%26ske%3D2023-12-01T23%253A14%253A34Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DtoLygme3hsBkFbr8Qbrk9sdki7CKqs6YS52kHXVWkd8%253D', | |
), | |
_videoItem( | |
'Blender 4.0 Is Here: A Revolution...For Free!', | |
'Two Minute Papers - 242K views - 2 days ago', | |
'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-dtDDtkEGoFccn5xaP5W1p3Rr%2Fuser-3XZA7QXb1LF8ADMIxEZC0Qp4%2Fimg-rZrrvYd20sV1hPbJtOidE8LJ.png%3Fst%3D2023-12-01T19%253A34%253A44Z%26se%3D2023-12-01T21%253A34%253A44Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2023-11-30T23%253A10%253A39Z%26ske%3D2023-12-01T23%253A10%253A39Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DSzmRyuZLBONGeMQndDPfkAKqr86UVV7I7k1h9NsjzKc%253D', | |
), | |
], | |
), | |
bottomNavigationBar: NavigationBar( | |
selectedIndex: _selectedIndex, | |
onDestinationSelected: _onItemTapped, | |
destinations: const [ | |
NavigationDestination( | |
icon: Icon(Icons.home_outlined), | |
selectedIcon: Icon(Icons.home), | |
label: 'Home', | |
), | |
NavigationDestination( | |
icon: Icon(Icons.play_arrow_outlined), | |
selectedIcon: Icon(Icons.play_arrow), | |
label: 'Shorts', | |
), | |
NavigationDestination( | |
icon: Icon(Icons.add_circle_outline), | |
selectedIcon: Icon(Icons.add_circle), | |
label: 'Add', | |
), | |
NavigationDestination( | |
icon: Icon(Icons.subscriptions_outlined), | |
selectedIcon: Icon(Icons.subscriptions), | |
label: 'Subscriptions', | |
), | |
NavigationDestination( | |
icon: Icon(Icons.video_library_outlined), | |
selectedIcon: Icon(Icons.video_library), | |
label: 'Library', | |
), | |
], | |
), | |
); | |
} | |
Widget _videoItem(String title, String channelInfo, String thumbnailUrl) { | |
return Column( | |
children: [ | |
Image.network( | |
thumbnailUrl, | |
width: double.infinity, | |
fit: BoxFit.cover, | |
), | |
ListTile( | |
title: Text(title), | |
subtitle: Text(channelInfo), | |
trailing: Icon(Icons.more_vert), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment