Mavzu: Androidda “ World Countries ” mobil ilovasini yaratish. Kirish



Download 4,64 Mb.
bet36/42
Sana31.12.2021
Hajmi4,64 Mb.
#257886
1   ...   32   33   34   35   36   37   38   39   ...   42
Bog'liq
bmi new

splash_content.dart

import 'package:flutter/material.dart';


import 'package:shop_app/constants.dart';
import 'package:shop_app/size_config.dart';

class SplashContent extends StatelessWidget {


const SplashContent({
Key key,
this.text,
this.image,
}) : super(key: key);
final String text, image;

@override


Widget build(BuildContext context) {
return Column(
children: [
Spacer(),
Text(
"UZ PLANET",
style: TextStyle(
fontSize: getProportionateScreenWidth(36),
color: kPrimaryColor,
fontWeight: FontWeight.bold),
),
Text(text,
textAlign: TextAlign.start,
),
Spacer(
flex: 2,
),
Image.asset(
image,
height: getProportionateScreenHeight(265),
width: getProportionateScreenWidth(235),
),
],
);
}
}
default_button.dart

import 'package:flutter/material.dart';

import '../constants.dart';
import '../size_config.dart';

class DefaultButton extends StatelessWidget {


const DefaultButton({
Key key, this.text, this.press
}) : super(key: key);
final String text;
final Function press;

@override


Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
height: getProportionateScreenHeight(56),
child: FlatButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
color: kPrimaryColor,
onPressed: press,
child: Text(
text,
style: TextStyle(
fontSize: getProportionateScreenWidth(18),
color: Colors.white),
)),
);
}
}

home_screen.dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:shop_app/example_screen.dart';
import 'package:shop_app/home/components/search_field.dart';
import 'package:shop_app/provider/country_provider.dart';
import '../constants.dart';
import '../size_config.dart';
import 'components/country_listtile_widget.dart';

class HomeScreen extends StatelessWidget {


static String routeName = "/home";

@override


Widget build(BuildContext context) {
final provider = Provider.of(context);
final allCountries = provider.countriesSorted;
SizeConfig().init(context);
return Provider(
create: (BuildContext context) =>provider,
child: Scaffold(
body: Column(
children: [
SizedBox(height: getProportionateScreenWidth(20)),
// SearchField(),
Padding(
padding: EdgeInsets.only(
top: getProportionateScreenWidth(10),
left: getProportionateScreenWidth(10),
right: getProportionateScreenWidth(10)),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: kSecondaryColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(15)),
child: TextField(
onChanged: (value) {
provider.loadCountriesWithQuery(value);
},
decoration: InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: "Qidiruv...",
prefixIcon: Icon(Icons.search),
contentPadding: EdgeInsets.symmetric(
horizontal: getProportionateScreenWidth(20),
vertical: getProportionateScreenWidth(11)),
),
),
),
),
Expanded(
child: ListView(
children: allCountries.map((country) {
return CountryListTileWidget(
country: country,
isSelected: false,
press: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ExampleScreen(
name: country.name.replaceAll(" ", "_").toLowerCase(),
),
),
),
);
}).toList(),
),
),
],
),
),
);
}
}
country_listtile_widget.dart

import 'package:flutter/material.dart';


import 'package:shop_app/models/country.dart';
import 'package:shop_app/size_config.dart';

import 'flag_widget.dart';

class CountryListTileWidget extends StatelessWidget {
final Country country;
final bool isSelected;
final GestureTapCallback press;

const CountryListTileWidget({


Key key,
@required this.country,
// @required this.isNative,
@required this.isSelected,
@required this.press,
}) : super(key: key);

@override


Widget build(BuildContext context) {
final selectedColor = Theme
.of(context)
.primaryColor;
final style = isSelected
? TextStyle(
fontSize: 18,
color: selectedColor,
fontWeight: FontWeight.bold,
)
: TextStyle(fontSize: 18);

return GestureDetector(


onTap: press,
child: Padding(
padding: EdgeInsets.only(left:getProportionateScreenWidth(8),right: getProportionateScreenWidth(8)),
child: Card(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
child: Column(
children: [
Row(
children: [
Column(
children: [
Padding(
padding: EdgeInsets.all(10),
child: FlagWidget(code: country.code),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
country.name,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 17, fontWeight: FontWeight.bold),
),
Text(
country.capital,
style: TextStyle(fontStyle: FontStyle.italic),
),
],
)
],
),
],
),
),
),
);
}
}

Download 4,64 Mb.

Do'stlaringiz bilan baham:
1   ...   32   33   34   35   36   37   38   39   ...   42




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish