Created
June 3, 2025 05:30
-
-
Save Kurogoma4D/ab65db1f3ffbfb20146485d1b2a4e2f8 to your computer and use it in GitHub Desktop.
Generated by Figma to code workflow on Dify, then made adjustments.
This file contains hidden or 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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData(colorSchemeSeed: Colors.blue), | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SafeArea( | |
child: Column( | |
children: [ | |
_buildHeader(), | |
Expanded( | |
child: _buildContent(context), | |
), | |
], | |
), | |
), | |
); | |
} | |
Widget _buildHeader() { | |
return Container( | |
padding: EdgeInsets.fromLTRB(16, 24, 16, 12), | |
color: Color(0xFFE4E4E4), | |
child: Row( | |
children: [ | |
Text( | |
'Title', | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontSize: 40, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
], | |
), | |
); | |
} | |
Widget _buildContent(BuildContext context) { | |
return ListView( | |
children: [ | |
_buildSearchBar(), | |
_buildListItem('List', 'Description', onTap: () { | |
Navigator.of(context).push( | |
MaterialPageRoute(builder: (context) => DetailScreen()), | |
); | |
}), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
_buildListItem('List', 'Description'), | |
], | |
); | |
} | |
Widget _buildSearchBar() { | |
return Padding( | |
padding: EdgeInsets.all(10), | |
child: TextField( | |
decoration: InputDecoration( | |
filled: true, | |
fillColor: Color(0xFFDFDFDF), | |
hintText: 'Search...', | |
border: OutlineInputBorder( | |
borderRadius: BorderRadius.circular(8), | |
borderSide: BorderSide.none, | |
), | |
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 12), | |
), | |
onSubmitted: (value) { | |
// Perform search | |
}, | |
), | |
); | |
} | |
Widget _buildListItem(String title, String description, {VoidCallback? onTap}) { | |
return GestureDetector( | |
onTap: onTap, | |
child: Container( | |
padding: EdgeInsets.fromLTRB(16, 0, 16, 8), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
title, | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontSize: 24, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
SizedBox(height: 10), | |
Text( | |
description, | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontSize: 20, | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} | |
class DetailScreen extends StatelessWidget { | |
const DetailScreen({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Column( | |
children: [ | |
Container( | |
color: Color(0xFFE4E4E4), | |
padding: EdgeInsets.fromLTRB(16, 24, 16, 12), | |
child: SafeArea( | |
child: Row( | |
children: [ | |
GestureDetector( | |
onTap: () => Navigator.of(context).pop(), | |
child: Container( | |
width: 32, | |
height: 32, | |
padding: EdgeInsets.all(8), | |
child: Icon(Icons.arrow_back, size: 24), | |
), | |
), | |
SizedBox(width: 10), | |
Text( | |
'Detail', | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontWeight: FontWeight.bold, | |
fontSize: 40, | |
), | |
), | |
], | |
), | |
), | |
), | |
Expanded( | |
child: Padding( | |
padding: EdgeInsets.fromLTRB(16, 32, 16, 12), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Container( | |
height: 200, | |
decoration: BoxDecoration( | |
color: Color(0xFFE3E3E3), | |
borderRadius: BorderRadius.circular(16), | |
), | |
), | |
SizedBox(height: 40), | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
'List', | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontWeight: FontWeight.bold, | |
fontSize: 24, | |
), | |
), | |
SizedBox(height: 10), | |
Text( | |
'Description', | |
style: TextStyle( | |
fontFamily: 'Inter', | |
fontSize: 20, | |
), | |
), | |
], | |
), | |
], | |
), | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment