diff --git "a/Task/Task\\2" "b/Task/Task\\2" new file mode 100644 index 0000000..4c523d2 --- /dev/null +++ "b/Task/Task\\2" @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; +import 'package:todo2/home.dart'; + +void main() { + runApp(MaterialApp( + debugShowCheckedModeBanner: false, + home: HomePage(), + )); +} + diff --git a/Task2/checkBox.dart b/Task2/checkBox.dart new file mode 100644 index 0000000..3e8ae08 --- /dev/null +++ b/Task2/checkBox.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +class Check extends StatelessWidget { + final bool isActive; + + const Check({Key? key, required this.isActive}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (isActive) { + return Container( + width: 30, + height: 30, + decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.pink), + child: Icon( + Icons.check, + size: 20, + color: Colors.white, + ), + ); + } else { + return Container( + width: 30, + height: 30, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + border: Border.all( + color: Colors.grey, + width: 3, + )), + child: Icon( + Icons.check, + size: 20, + color: Colors.white, + ), + ); + } + } +} diff --git a/Task2/home.dart b/Task2/home.dart new file mode 100644 index 0000000..582cc1e --- /dev/null +++ b/Task2/home.dart @@ -0,0 +1,143 @@ +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:todo2/home.dart'; +import 'package:todo2/todo.dart'; + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + Map todo = {}; + TextEditingController _controller = new TextEditingController(); + + @override + void initState() { + _loadData(); + } + + _loadData() async { + SharedPreferences storage = await SharedPreferences.getInstance(); + + if (storage.getString('todo') != null) { + var storage2 = storage; + var string = storage2.getString('todo'); + todo = jsonDecode(string!); + } + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + home: SafeArea( + child: Scaffold( + appBar: AppBar( + title: Text('Todo App'), + backgroundColor: Colors.pink, + ), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Expanded( + child: ListView.builder( + itemCount: todo.length, + itemBuilder: (context, data) { + return Dismissible( + key: Key('item' + data.toString()), + onDismissed: (direction) { + todo.remove(todo.keys.elementAt(data)); + _save(); + }, + child: InkWell( + onTap: () { + setState(() { + todo[todo.keys.elementAt(data)] = + !todo[todo.keys.elementAt(data)]; + }); + _save(); + }, + child: TodoItem( + name: todo.keys.elementAt(data), + isActive: todo.values.elementAt(data)), + ), + ); + }, + ), + ) + ], + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Scaffold( + appBar: AppBar( + backgroundColor: Colors.pink, + ), + body: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextFormField( + controller: _controller, + keyboardType: TextInputType.multiline, + maxLines: null, + decoration: InputDecoration( + hintText: 'Write....', + ), + ), + ), + //actions: + FlatButton( + child: Text( + 'save', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + ), + onPressed: () { + Navigator.pop(context); + _addTodo(); + }, + ), + //child: child) + ], + ), + )))); + }, + child: Icon(Icons.add), + backgroundColor: Colors.pink, + ), + ), + ), + ); + } + + _addTodo() async { + setState(() {}); + SharedPreferences storage = await SharedPreferences.getInstance(); + + if (_controller.text.length > 0) { + setState(() { + todo.putIfAbsent(_controller.text, () => false); + storage.setString('todo', jsonEncode(todo)); + }); + } + setState(() {}); + } + + _save() async { + SharedPreferences storage = await SharedPreferences.getInstance(); + + storage.setString('todo', jsonEncode(todo)); + } +} diff --git a/Task2/main.dart b/Task2/main.dart new file mode 100644 index 0000000..6d2d820 --- /dev/null +++ b/Task2/main.dart @@ -0,0 +1,9 @@ +import 'package:flutter/material.dart'; +import 'package:todo2/home.dart'; + +void main() { + runApp(MaterialApp( + debugShowCheckedModeBanner: false, + home: HomePage(), + )); +} diff --git a/Task2/todo.dart b/Task2/todo.dart new file mode 100644 index 0000000..edd88db --- /dev/null +++ b/Task2/todo.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +import 'package:todo2/checkBox.dart'; + +class TodoItem extends StatefulWidget { + final String name; + final bool isActive; + + const TodoItem({Key? key, required this.name, required this.isActive}) + : super(key: key); + + @override + _TodoItemState createState() => _TodoItemState(); +} + +class _TodoItemState extends State { + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 50), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: MediaQuery.of(context).size.width / 100 * 50, + child: Text( + widget.name, + style: TextStyle( + fontSize: 17, + color: Colors.black, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + softWrap: true, + ), + ), + ///////////////////////////////// + Row( + children: [ + Text( + DateFormat('d ').format(DateTime.now()), + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: Colors.black45), + ), + Text( + DateFormat('MMM ').format(DateTime.now()).toUpperCase(), + style: TextStyle( + fontWeight: FontWeight.bold, color: Colors.black45), + ), + Text( + DateFormat('y').format(DateTime.now()), + style: TextStyle( + fontWeight: FontWeight.bold, color: Colors.black45), + ), + ], + ), + + ///////////////////////////////// + Check( + isActive: widget.isActive, + ) + ], + ), + ); + } +} diff --git a/Task3/images/clear.png b/Task3/images/clear.png new file mode 100644 index 0000000..b8d8fea Binary files /dev/null and b/Task3/images/clear.png differ diff --git a/Task3/images/cloudy.png b/Task3/images/cloudy.png new file mode 100644 index 0000000..491a2f2 Binary files /dev/null and b/Task3/images/cloudy.png differ diff --git a/Task3/images/forest.png b/Task3/images/forest.png new file mode 100644 index 0000000..ebff71b Binary files /dev/null and b/Task3/images/forest.png differ diff --git a/Task3/images/nighcity.png b/Task3/images/nighcity.png new file mode 100644 index 0000000..0b62325 Binary files /dev/null and b/Task3/images/nighcity.png differ diff --git a/Task3/images/rainy.png b/Task3/images/rainy.png new file mode 100644 index 0000000..b8f3bfe Binary files /dev/null and b/Task3/images/rainy.png differ diff --git a/Task3/images/snow.png b/Task3/images/snow.png new file mode 100644 index 0000000..d688fb3 Binary files /dev/null and b/Task3/images/snow.png differ diff --git a/Task3/images/splash.png b/Task3/images/splash.png new file mode 100644 index 0000000..70bb1e1 Binary files /dev/null and b/Task3/images/splash.png differ diff --git a/Task3/images/sunset.png b/Task3/images/sunset.png new file mode 100644 index 0000000..49fdd85 Binary files /dev/null and b/Task3/images/sunset.png differ diff --git a/Task3/images/thunderstorm.png b/Task3/images/thunderstorm.png new file mode 100644 index 0000000..0529c83 Binary files /dev/null and b/Task3/images/thunderstorm.png differ diff --git a/Task3/lib/cubit/weather_cubit.dart b/Task3/lib/cubit/weather_cubit.dart new file mode 100644 index 0000000..a92292f --- /dev/null +++ b/Task3/lib/cubit/weather_cubit.dart @@ -0,0 +1,30 @@ +import 'package:bloc/bloc.dart'; +import 'package:meta/meta.dart'; +import 'package:flutter_application_6/models/forecast.dart'; +import 'package:flutter_application_6/services/repository.dart'; + +part 'weather_state.dart'; + +class WeatherCubit extends Cubit { + final IRepository _repository; + WeatherCubit(this._repository) + : super(WeatherInitial('Please enter city name.')); + + Future getWeather(String cityName, bool isFavourite) async { + try { + emit(WeatherLoading()); + final forecast = await _repository.getWeather(cityName.trim()); + forecast.city = cityName; + //forecast.isFavourite = isFavourite; + emit(WeatherLoaded(forecast: forecast)); + } catch (_) { + if (cityName.isEmpty) { + emit(WeatherError("Please enter city name.")); + } else if (_.toString().contains('error retrieving location for city')) { + emit(WeatherError("City not found.")); + } else { + emit(WeatherError("Network error, please try again")); + } + } + } +} diff --git a/Task3/lib/cubit/weather_state.dart b/Task3/lib/cubit/weather_state.dart new file mode 100644 index 0000000..d1c615c --- /dev/null +++ b/Task3/lib/cubit/weather_state.dart @@ -0,0 +1,22 @@ +part of 'weather_cubit.dart'; + +@immutable +abstract class WeatherState {} + +class WeatherInitial extends WeatherState { + final String message; + WeatherInitial(this.message); +} + +class WeatherLoading extends WeatherState {} + +class WeatherLoaded extends WeatherState { + final Forecast forecast; + + WeatherLoaded({required this.forecast}) : super(); +} + +class WeatherError extends WeatherState { + final String message; + WeatherError(this.message); +} diff --git a/Task3/lib/di/initialize_dependency.dart b/Task3/lib/di/initialize_dependency.dart new file mode 100644 index 0000000..3c5fa18 --- /dev/null +++ b/Task3/lib/di/initialize_dependency.dart @@ -0,0 +1,16 @@ +import 'package:get_it/get_it.dart'; +import 'package:flutter_application_6/services/repository.dart'; +import 'package:flutter_application_6/services/weather_api.dart'; +import 'package:http/http.dart' as http; + +GetIt injector = GetIt.instance; + +Future initializeDependency() async { + injector.registerSingleton(http.Client()); + + injector + .registerSingleton(WeatherApi(injector.get())); + + injector + .registerSingleton(Repository(injector.get())); +} diff --git a/Task3/lib/main.dart b/Task3/lib/main.dart new file mode 100644 index 0000000..01309ff --- /dev/null +++ b/Task3/lib/main.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'cubit/weather_cubit.dart'; +import 'di/initialize_dependency.dart'; +import 'pages/home_page.dart'; +import 'services/repository.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + initializeDependency(); + runApp(const App()); +} + +class App extends StatelessWidget { + const App({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const AppView(); + } +} + +class AppView extends StatelessWidget { + const AppView({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + home: MultiBlocProvider( + providers: [ + BlocProvider( + create: (BuildContext context) => + WeatherCubit(injector.get()), + ), + ], + child: const MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Weather App', + home: HomePage(), + ))); + } +} + +class Splash extends StatelessWidget { + @override + Widget build(BuildContext context) { + bool lightMode = + MediaQuery.of(context).platformBrightness == Brightness.dark; + return Scaffold( + backgroundColor: lightMode + ? Color(0x000000).withOpacity(1.0) + : Color(0x000000).withOpacity(1.0), + body: Center( + child: lightMode + ? Image.asset('images/splash.png') + : Image.asset('images/splash.png')), + ); + } +} + +class Init { + Init._(); + static final instance = Init._(); + + Future initialize() async { + await Future.delayed(const Duration(seconds: 5)); + } +} diff --git a/Task3/lib/models/forecast.dart b/Task3/lib/models/forecast.dart new file mode 100644 index 0000000..c0224e1 --- /dev/null +++ b/Task3/lib/models/forecast.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:flutter_application_6/utils/extensions.dart'; +import 'package:flutter_application_6/utils/temp_converter.dart'; + +import 'weather.dart'; + +class Forecast { + final TimeOfDay lastUpdated; + final List daily; + Weather current; + bool isDayTime; + String city; + String sunset; + String sunrise; + String date; + bool isFavourite = false; + + Forecast( + {required this.lastUpdated, + this.daily = const [], + required this.current, + this.city = '', + required this.isDayTime, + required this.sunrise, + required this.sunset, + required this.date}); + + static Forecast fromJson(dynamic json) { + var weather = json['current']['weather'][0]; + var date = + DateTime.fromMillisecondsSinceEpoch(json['current']['dt'] * 1000); + + var sunrise = + DateTime.fromMillisecondsSinceEpoch(json['current']['sunrise'] * 1000); + + var sunset = + DateTime.fromMillisecondsSinceEpoch(json['current']['sunset'] * 1000); + + bool isDay = date.isAfter(sunrise) && date.isBefore(sunset); + + bool hasDaily = json['daily'] != null; + List tempDaily = []; + if (hasDaily) { + List items = json['daily']; + tempDaily = items + .map((item) => Weather.fromDailyJson(item)) + .toList() + .skip(1) + .take(7) + .toList(); + } + + var currentForcast = Weather( + cloudiness: int.parse(json['current']['clouds'].toString()), + temp: + '${Weather.formatTemperature(TempConverter.kelvinToCelsius(double.parse(json['current']['temp'].toString())))}°', + condition: Weather.mapStringToWeatherCondition( + weather['main'], int.parse(json['current']['clouds'].toString())), + description: weather['description'].toString().capitalize(), + feelLikeTemp: + '${Weather.formatTemperature(TempConverter.kelvinToCelsius(double.parse(json['current']['feels_like'].toString())))}°', + date: DateFormat('d EEE').format(date), + sunrise: DateFormat.jm().format(sunrise), + sunset: DateFormat.jm().format(sunset)); + + return Forecast( + lastUpdated: TimeOfDay.fromDateTime(DateTime.now()), + current: currentForcast, + daily: tempDaily, + isDayTime: isDay, + sunset: DateFormat.jm().format(sunset), + sunrise: DateFormat.jm().format(sunrise), + date: DateFormat('d EEE').format(date)); + } +} diff --git a/Task3/lib/models/location.dart b/Task3/lib/models/location.dart new file mode 100644 index 0000000..c9af085 --- /dev/null +++ b/Task3/lib/models/location.dart @@ -0,0 +1,15 @@ +class Location { + final double longitude; + final double latitude; + + Location({ + required this.longitude, + required this.latitude, + }); + + static Location fromJson(dynamic json) { + return Location( + longitude: json['coord']['lon'].toDouble(), + latitude: json['coord']['lat'].toDouble()); + } +} diff --git a/Task3/lib/models/weather.dart b/Task3/lib/models/weather.dart new file mode 100644 index 0000000..887b4f6 --- /dev/null +++ b/Task3/lib/models/weather.dart @@ -0,0 +1,96 @@ +import 'package:intl/intl.dart'; +import 'package:flutter_application_6/utils/extensions.dart'; +import 'package:flutter_application_6/utils/temp_converter.dart'; + +enum WeatherCondition { + thunderstorm, + drizzle, + rain, + snow, + mist, + lightCloud, + heavyCloud, + clear, + unknown +} + +class Weather { + WeatherCondition condition; + final String description; + final String temp; + final String feelLikeTemp; + final int cloudiness; + final String date; + final String sunrise; + final String sunset; + + Weather( + {required this.condition, + required this.description, + required this.temp, + required this.feelLikeTemp, + required this.cloudiness, + required this.date, + required this.sunrise, + required this.sunset}); + + static Weather fromDailyJson(dynamic daily) { + var cloudiness = daily['clouds']; + var weather = daily['weather'][0]; + + return Weather( + condition: mapStringToWeatherCondition(weather['main'], cloudiness), + description: weather['description'].toString().capitalize(), + cloudiness: cloudiness, + temp: + '${formatTemperature(TempConverter.kelvinToCelsius(double.parse(daily['temp']['day'].toString())))}°', + date: DateFormat('d EEE') + .format(DateTime.fromMillisecondsSinceEpoch(daily['dt'] * 1000)), + sunrise: DateFormat.jm().format( + DateTime.fromMillisecondsSinceEpoch(daily['sunrise'] * 1000)), + sunset: DateFormat.jm().format( + DateTime.fromMillisecondsSinceEpoch(daily['sunset'] * 1000)), + feelLikeTemp: + '${formatTemperature(TempConverter.kelvinToCelsius(double.parse(daily['feels_like']['day'].toString())))}°'); + } + + static String formatTemperature(double t) { + // ignore: unnecessary_null_comparison + var temp = (t == null ? '' : t.round().toString()); + return temp; + } + + static WeatherCondition mapStringToWeatherCondition( + String input, int cloudiness) { + WeatherCondition condition; + switch (input) { + case 'Thunderstorm': + condition = WeatherCondition.thunderstorm; + break; + case 'Drizzle': + condition = WeatherCondition.drizzle; + break; + case 'Rain': + condition = WeatherCondition.rain; + break; + case 'Snow': + condition = WeatherCondition.snow; + break; + case 'Clear': + condition = WeatherCondition.clear; + break; + case 'Clouds': + condition = (cloudiness >= 85) + ? WeatherCondition.heavyCloud + : WeatherCondition.lightCloud; + break; + case 'Mist': + condition = WeatherCondition.mist; + break; + default: + condition = WeatherCondition.unknown; + } + + return condition; + } +} diff --git a/Task3/lib/pages/home_page.dart b/Task3/lib/pages/home_page.dart new file mode 100644 index 0000000..3e82a2b --- /dev/null +++ b/Task3/lib/pages/home_page.dart @@ -0,0 +1,147 @@ +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter_application_6/main.dart'; +import 'dart:async'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_application_6/cubit/weather_cubit.dart'; +import 'package:flutter_application_6/models/forecast.dart'; +import 'package:flutter_application_6/models/weather.dart'; +import 'widgets/city_information_widget.dart'; +import 'widgets/city_entry_widget.dart'; +import 'widgets/daily_summary_widget.dart'; +import 'widgets/indicator_widget.dart'; +import 'widgets/last_update_widget.dart'; +import 'widgets/weather_description_widget.dart'; +import 'widgets/weather_summary_widget.dart'; + +class HomePage extends StatefulWidget { + const HomePage({Key? key}) : super(key: key); + + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + Completer? _refreshCompleter; + Forecast? _forecast; + bool isSelectedDate = false; + + @override + void initState() { + super.initState(); + _refreshCompleter = Completer(); + } + + void searchCity() { + isSelectedDate = false; + _forecast = null; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('images/sunset.png'), fit: BoxFit.cover)), + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), + child: Container( + color: Colors.black.withOpacity(0.2), + height: MediaQuery.of(context).size.height, + child: RefreshIndicator( + color: Colors.transparent, + backgroundColor: Colors.transparent, + onRefresh: () => refreshWeather( + (BlocProvider.of(context).state + as WeatherLoaded) + .forecast), + child: ListView(children: [ + CityEntryWidget(callBackFunction: searchCity), + BlocBuilder( + builder: (context, state) { + if (state is WeatherInitial) { + return buildMessageText(state.message); + } else if (state is WeatherLoading) { + return const IndicatorWidget(); + } else if (state is WeatherLoaded) { + if (!isSelectedDate) { + _forecast = state.forecast; + } + return buildColumnWithData(); + } else if (state is WeatherError) { + return buildMessageText(state.message); + } else { + return const IndicatorWidget(); + } + }) + ])))))); + } + + Widget buildMessageText(String message) { + return Padding( + padding: const EdgeInsets.only(top: 30), + child: Center( + child: Text(message, + style: const TextStyle(fontSize: 21, color: Colors.white)))); + } + + Widget buildColumnWithData() { + return Column(children: [ + CityInformationWidget( + city: _forecast!.city, + sunrise: _forecast!.sunrise, + sunset: _forecast!.sunset, + isFavourite: _forecast!.isFavourite), + const SizedBox(height: 40), + WeatherSummaryWidget( + date: _forecast!.date, + condition: _forecast!.current.condition, + temp: _forecast!.current.temp, + feelsLike: _forecast!.current.feelLikeTemp), + const SizedBox(height: 20), + WeatherDescriptionWidget( + weatherDescription: _forecast!.current.description), + const SizedBox(height: 40), + buildDailySummary(_forecast!.daily), + LastUpdatedWidget(lastUpdatedOn: _forecast!.lastUpdated) + ]); + } + + Widget buildDailySummary(List dailyForecast) { + return Container( + height: 120, + padding: const EdgeInsets.symmetric(horizontal: 10), + child: ListView.builder( + physics: const BouncingScrollPhysics(), + scrollDirection: Axis.horizontal, + itemCount: dailyForecast.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + isSelectedDate = true; + _forecast!.date = dailyForecast[index].date; + _forecast!.sunrise = dailyForecast[index].sunrise; + _forecast!.sunset = dailyForecast[index].sunset; + _forecast!.current = dailyForecast[index]; + + _refreshCompleter?.complete(); + _refreshCompleter = Completer(); + refreshWeather(_forecast!); + }, + child: DailySummaryWidget(weather: dailyForecast[index])); + })); + } + + Future refreshWeather(Forecast forecast) { + if (isSelectedDate) { + setState(() { + _forecast = forecast; + }); + return _refreshCompleter!.future; + } else { + return BlocProvider.of(context) + .getWeather(forecast.city, forecast.isFavourite); + } + } +} diff --git a/Task3/lib/pages/widgets/city_entry_widget.dart b/Task3/lib/pages/widgets/city_entry_widget.dart new file mode 100644 index 0000000..5a7109b --- /dev/null +++ b/Task3/lib/pages/widgets/city_entry_widget.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_application_6/cubit/weather_cubit.dart'; + +class CityEntryWidget extends StatefulWidget { + const CityEntryWidget({Key? key, required this.callBackFunction}) + : super(key: key); + + final Function callBackFunction; + + @override + _CityEntryWidgetState createState() => _CityEntryWidgetState(); +} + +class _CityEntryWidgetState extends State { + late TextEditingController cityEditController; + + @override + void initState() { + super.initState(); + + cityEditController = TextEditingController(); + } + + void submitCityName(BuildContext context, String cityName) { + BlocProvider.of(context).getWeather(cityName, false); + widget.callBackFunction(); + cityEditController.text = ''; + } + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(left: 10, top: 15, right: 10), + height: 50, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(3), + topRight: Radius.circular(3), + bottomLeft: Radius.circular(3), + bottomRight: Radius.circular(3)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + spreadRadius: 3, + blurRadius: 5, + offset: const Offset(0, 3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + IconButton( + icon: const Icon(Icons.search), + onPressed: () => + submitCityName(context, cityEditController.text)), + const SizedBox(width: 10), + Expanded( + child: TextField( + controller: cityEditController, + decoration: + const InputDecoration.collapsed(hintText: "Enter City"), + onSubmitted: (String city) => + submitCityName(context, city))), + ], + )); + } +} diff --git a/Task3/lib/pages/widgets/city_information_widget.dart b/Task3/lib/pages/widgets/city_information_widget.dart new file mode 100644 index 0000000..aba094c --- /dev/null +++ b/Task3/lib/pages/widgets/city_information_widget.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +class CityInformationWidget extends StatefulWidget { + CityInformationWidget( + {Key? key, + required this.city, + required this.sunrise, + required this.sunset, + required this.isFavourite}) + : super(key: key); + + final String city; + final String sunset; + final String sunrise; + bool isFavourite; + + @override + _CityInformationWidgetState createState() => _CityInformationWidgetState(); +} + +class _CityInformationWidgetState extends State { + bool isFavourite = false; + + @override + void initState() { + isFavourite = widget.isFavourite; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column(children: [ + Text(widget.city.toUpperCase(), + style: const TextStyle( + fontSize: 50, + fontWeight: FontWeight.w300, + color: Colors.white, + )), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Column(children: [ + const Text('Sunrise', + style: TextStyle(fontSize: 16, color: Colors.white)), + const SizedBox(height: 5), + Text(widget.sunrise, + style: const TextStyle(fontSize: 15, color: Colors.white)) + ]), + const SizedBox(width: 20), + Column(children: [ + const Text('Sunset', + style: TextStyle(fontSize: 16, color: Colors.white)), + const SizedBox(height: 5), + Text(widget.sunset, + style: const TextStyle(fontSize: 15, color: Colors.white)) + ]), + ]), + ]); + } +} diff --git a/Task3/lib/pages/widgets/daily_summary_widget.dart b/Task3/lib/pages/widgets/daily_summary_widget.dart new file mode 100644 index 0000000..11894c7 --- /dev/null +++ b/Task3/lib/pages/widgets/daily_summary_widget.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:flutter_application_6/models/weather.dart'; + +class DailySummaryWidget extends StatelessWidget { + const DailySummaryWidget({Key? key, required this.weather}) : super(key: key); + + final Weather weather; + + @override + Widget build(BuildContext context) { + final dayOfWeek = toBeginningOfSentenceCase(weather.date); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 5), + child: Container( + width: 100, + height: 120, + decoration: BoxDecoration( + color: Colors.white10, borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text(dayOfWeek ?? '', + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 18, + color: Colors.white, + fontWeight: FontWeight.w300)), + Text(weather.temp, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 20, + color: Colors.white, + fontWeight: FontWeight.w500)), + ]), + )); + } +} diff --git a/Task3/lib/pages/widgets/gradient_container_widget.dart b/Task3/lib/pages/widgets/gradient_container_widget.dart new file mode 100644 index 0000000..4cb85ee --- /dev/null +++ b/Task3/lib/pages/widgets/gradient_container_widget.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +class GradientContainerWidget extends StatelessWidget { + const GradientContainerWidget( + {Key? key, required this.color, required this.child}) + : super(key: key); + + final Widget child; + final MaterialColor color; + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + stops: const [0, 1.0], + colors: [ + color.shade800, + color.shade400, + ], + ), + ), + child: child, + ); + } +} diff --git a/Task3/lib/pages/widgets/indicator_widget.dart b/Task3/lib/pages/widgets/indicator_widget.dart new file mode 100644 index 0000000..6b84a7a --- /dev/null +++ b/Task3/lib/pages/widgets/indicator_widget.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +class IndicatorWidget extends StatelessWidget { + const IndicatorWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 30), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.white)), + SizedBox(height: 20), + Text('Please Wait...', + style: TextStyle( + fontSize: 18, + color: Colors.white, + fontWeight: FontWeight.w300, + )) + ])); + } +} diff --git a/Task3/lib/pages/widgets/last_update_widget.dart b/Task3/lib/pages/widgets/last_update_widget.dart new file mode 100644 index 0000000..e131063 --- /dev/null +++ b/Task3/lib/pages/widgets/last_update_widget.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class LastUpdatedWidget extends StatelessWidget { + const LastUpdatedWidget({Key? key, required this.lastUpdatedOn}) + : super(key: key); + + final TimeOfDay lastUpdatedOn; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 20.0, left: 00), + child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [])); + } +} diff --git a/Task3/lib/pages/widgets/weather_description_widget.dart b/Task3/lib/pages/widgets/weather_description_widget.dart new file mode 100644 index 0000000..0e195f5 --- /dev/null +++ b/Task3/lib/pages/widgets/weather_description_widget.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class WeatherDescriptionWidget extends StatelessWidget { + const WeatherDescriptionWidget({Key? key, required this.weatherDescription}) + : super(key: key); + + final String weatherDescription; + + @override + Widget build(BuildContext context) { + return Center( + child: Text(weatherDescription, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 30, + fontWeight: FontWeight.w300, + color: Colors.white, + ))); + } +} diff --git a/Task3/lib/pages/widgets/weather_summary_widget.dart b/Task3/lib/pages/widgets/weather_summary_widget.dart new file mode 100644 index 0000000..d6f35eb --- /dev/null +++ b/Task3/lib/pages/widgets/weather_summary_widget.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_application_6/models/weather.dart'; + +class WeatherSummaryWidget extends StatelessWidget { + const WeatherSummaryWidget( + {Key? key, + required this.date, + required this.condition, + required this.temp, + required this.feelsLike}) + : super(key: key); + + final WeatherCondition condition; + final String temp; + final String feelsLike; + final String date; + + @override + Widget build(BuildContext context) { + return Center( + child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + Text(date, + style: const TextStyle( + fontSize: 40, + color: Colors.white, + )), + _mapWeatherConditionToImage(condition), + Column( + children: [ + Text( + temp, + style: const TextStyle( + fontSize: 50, + color: Colors.white, + fontWeight: FontWeight.w300, + ), + ), + Text( + 'Feels like $feelsLike', + style: const TextStyle( + fontSize: 18, + color: Colors.white, + fontWeight: FontWeight.w300, + ), + ), + ], + ), + ]), + ); + } + + Widget _mapWeatherConditionToImage(WeatherCondition condition) { + Image image; + switch (condition) { + case WeatherCondition.clear: + case WeatherCondition.lightCloud: + image = Image.asset('images/clear.png'); + break; + case WeatherCondition.snow: + image = Image.asset('images/snow.png'); + break; + case WeatherCondition.heavyCloud: + image = Image.asset('images/cloudy.png'); + break; + case WeatherCondition.drizzle: + case WeatherCondition.mist: + case WeatherCondition.rain: + image = Image.asset('images/rainy.png'); + break; + case WeatherCondition.thunderstorm: + image = Image.asset('images/thunderstorm.png'); + break; + case WeatherCondition.unknown: + image = Image.asset('images/clear.png'); + break; + } + + return Padding(padding: const EdgeInsets.only(top: 5), child: image); + } +} diff --git a/Task3/lib/services/constants.dart b/Task3/lib/services/constants.dart new file mode 100644 index 0000000..ccbd576 --- /dev/null +++ b/Task3/lib/services/constants.dart @@ -0,0 +1,2 @@ +const endPointUrl = 'https://api.openweathermap.org/data/2.5'; +const apiKey = "c5c389452a2eaf047359d0b40421dfb2"; diff --git a/Task3/lib/services/repository.dart b/Task3/lib/services/repository.dart new file mode 100644 index 0000000..9bb32f9 --- /dev/null +++ b/Task3/lib/services/repository.dart @@ -0,0 +1,19 @@ +import 'package:flutter_application_6/models/forecast.dart'; +import 'package:flutter_application_6/services/weather_api.dart'; + +abstract class IRepository { + Future getWeather(String city); +} + +class Repository extends IRepository { + final IWeatherApi weatherApi; + Repository(this.weatherApi); + + @override + Future getWeather(String city) async { + final location = await weatherApi.getLocation(city); + return await weatherApi.getWeather(location); + } +} + +class NetworkException implements Exception {} diff --git a/Task3/lib/services/weather_api.dart b/Task3/lib/services/weather_api.dart new file mode 100644 index 0000000..beeb8e5 --- /dev/null +++ b/Task3/lib/services/weather_api.dart @@ -0,0 +1,42 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:flutter_application_6/models/forecast.dart'; +import 'package:flutter_application_6/models/location.dart'; +import 'package:flutter_application_6/services/constants.dart'; + +abstract class IWeatherApi { + Future getWeather(Location location); + Future getLocation(String city); +} + +class WeatherApi extends IWeatherApi { + final http.Client httpClient; + + WeatherApi(this.httpClient); + + @override + Future getLocation(String city) async { + final requestUrl = '$endPointUrl/weather?q=$city&APPID=$apiKey'; + final response = await httpClient.get(Uri.parse(requestUrl)); + + if (response.statusCode != 200) { + throw Exception( + 'error retrieving location for city $city: ${response.statusCode}'); + } + + return Location.fromJson(jsonDecode(response.body)); + } + + @override + Future getWeather(Location location) async { + final requestUrl = + '$endPointUrl/onecall?lat=${location.latitude}&lon=${location.longitude}&exclude=hourly,minutely&APPID=$apiKey'; + final response = await httpClient.get(Uri.parse(requestUrl)); + + if (response.statusCode != 200) { + throw Exception('error retrieving weather: ${response.statusCode}'); + } + + return Forecast.fromJson(jsonDecode(response.body)); + } +} diff --git a/Task3/lib/utils/extensions.dart b/Task3/lib/utils/extensions.dart new file mode 100644 index 0000000..cd78bdd --- /dev/null +++ b/Task3/lib/utils/extensions.dart @@ -0,0 +1,9 @@ +extension StringExtension on String { + String capitalize() { + String result = ''; + split(' ').forEach((element) { + result += element[0].toUpperCase() + element.substring(1) + ' '; + }); + return result.trim(); + } +} diff --git a/Task3/lib/utils/temp_converter.dart b/Task3/lib/utils/temp_converter.dart new file mode 100644 index 0000000..fbd534a --- /dev/null +++ b/Task3/lib/utils/temp_converter.dart @@ -0,0 +1,5 @@ +class TempConverter { + static double kelvinToCelsius(double kelvin) { + return double.parse((kelvin - 273.15).toStringAsFixed(2)); + } +} diff --git a/Task3/pubspec.yaml b/Task3/pubspec.yaml new file mode 100644 index 0000000..63c7531 --- /dev/null +++ b/Task3/pubspec.yaml @@ -0,0 +1,94 @@ +name: flutter_application_6 +description: A new Flutter project. + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.12.0 <3.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + flutter_bloc: ^7.3.1 + intl: ^0.17.0 + http: ^0.13.4 + get_it: ^7.2.0 + flutter_native_splash: ^1.2.4 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^1.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - images/ + + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/lib/main.dart b/lib/main.dart index 2c084ed..efef6c1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,61 +1,49 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'dart:math' as math; -void main() { - runApp(const MyApp()); -} - -class Contact { - String image; - String name; - String mobileNumber; - DateTime date; - bool isIncoming; +import 'package:flutter/rendering.dart'; - Contact(this.image, this.name, this.mobileNumber, this.date, this.isIncoming); -} +void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); + static const String _title = 'Flutter Code Sample'; + @override Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo 2', - theme: ThemeData( - primarySwatch: Colors.blue, - ), + return const MaterialApp( + title: _title, + home: MyStatefulWidget(), debugShowCheckedModeBanner: false, - home: const MyHomePage(title: 'Contacts App'), ); } } -class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; +class MyStatefulWidget extends StatefulWidget { + const MyStatefulWidget({Key? key}) : super(key: key); @override - State createState() => _MyHomePageState(); + State createState() => _MyStatefulWidgetState(); } -class _MyHomePageState extends State { - int _selectedIndex = 2; +/// This is the private State class that goes with MyStatefulWidget. +class _MyStatefulWidgetState extends State { + int _selectedIndex = 0; static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); - static late List _pages; - - _MyHomePageState() { - _pages = [ - buildContactsList(), - buildFavoritesGridView(), - // Text('hello'), - Text( - 'Index 2: School', - style: optionStyle, - ), - ]; - } + TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static List _widgetOptions = [ + HomeScreen(), + Text( + 'Go to my profile', + style: optionStyle, + ), + Text( + 'Go to my profile ', + style: optionStyle, + ), + personal(), + ]; void _onItemTapped(int index) { setState(() { @@ -63,193 +51,1465 @@ class _MyHomePageState extends State { }); } - var contacts = [ - Contact( - 'https://i.pravatar.cc/300', - 'Ahmed', - '71766137347', - DateTime.now().add( - const Duration(seconds: 3), + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.network( + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcROrrA84D8J5d1acgBQnJdoEAraPu0Igriw1g&usqp=CAU', + height: 35, + ), + SizedBox(width: 500), + Image.network( + 'https://cdn3.iconfinder.com/data/icons/instagram-18/512/199_Instagram_Plus_Sets_Upload-512.png', + height: 35, + ), + //SizedBox(width: 100), + Image.network( + 'https://st2.depositphotos.com/38069286/42112/v/600/depositphotos_421121214-stock-illustration-direct-messages-button-icon-isolated.jpg', + height: 60, + ), + ], + ), + ], + )), + body: Center( + child: _widgetOptions.elementAt(_selectedIndex), ), - true, - ), - Contact( - 'https://i.pravatar.cc/301', - 'Ali', - '71766137347', - DateTime.now().add( - const Duration(days: 1), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/302', - 'Kamal', - '71766137347', - DateTime.now().add( - const Duration(days: 3), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/303', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/304', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/305', - 'Hussein', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/306', - 'Aboud', - '71766137347', - DateTime.now().add( - const Duration(days: 7), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/307', - 'Osama', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - ]; + bottomNavigationBar: BottomNavigationBar( + items: const [ + BottomNavigationBarItem( + icon: Icon( + Icons.home_outlined, + ), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon( + Icons.search_outlined, + ), + label: 'Post', + activeIcon: Icon( + Icons.search_outlined, + )), + BottomNavigationBarItem( + icon: Icon( + Icons.favorite_border_outlined, + ), + label: 'Notification', + ), + BottomNavigationBarItem( + icon: CircleAvatar( + radius: 30, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/001/912/726/non_2x/beautiful-woman-in-frame-circular-avatar-character-free-vector.jpg'), + ), - Widget buildFavoritesGridView() { - return Column( - children: [ - Text('Favorites'), - Divider(thickness: 4,), - Expanded( - child: GridView.count( - crossAxisCount: 3, - children: List.generate(5, (index) { - var personColor = Color((math.Random().nextDouble() * 0xFFFFFF).toInt()) - .withOpacity(1.0); - return Center( - child: Container( - width: 120, - height: 120, - child: Text( - contacts[index].name[0], - style: TextStyle(fontSize: 40), - ), - alignment: Alignment.center, - decoration: - BoxDecoration(shape: BoxShape.circle, color: personColor), - ), - ); - }), + activeIcon: CircleAvatar( + radius: 33, + backgroundColor: Colors.black, + child: CircleAvatar( + radius: 32, + backgroundColor: Colors.white, + child: CircleAvatar( + radius: 30, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/001/912/726/non_2x/beautiful-woman-in-frame-circular-avatar-character-free-vector.jpg', + ), + )), + ), + label: 'Personal profile', + //backgroundColor: Colors.pink, ), - ), - ], + ], + currentIndex: _selectedIndex, + selectedItemColor: Colors.black87, + unselectedItemColor: Colors.black54, + onTap: _onItemTapped, + iconSize: 40.0, + showSelectedLabels: false, + showUnselectedLabels: false, + type: BottomNavigationBarType.fixed, + ), ); } +} - Widget buildContactItem(Contact _contact) { - return Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - CircleAvatar( - backgroundImage: NetworkImage(_contact.image), +Widget HomeScreen() { + return SingleChildScrollView( + child: Column(children: [ + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row(children: [ + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/001/912/726/non_2x/beautiful-woman-in-frame-circular-avatar-character-free-vector.jpg'), + ), + Positioned( + right: -0.2, + bottom: -0.2, + child: CircleAvatar( + radius: 12, + backgroundColor: Colors.white, + child: Icon( + Icons.add_circle_outlined, + color: Colors.blue, + ))), + ], ), - Padding( - padding: const EdgeInsets.all(16), + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _contact.name, - style: const TextStyle(fontWeight: FontWeight.bold), + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/002/603/683/non_2x/mother-day-mom-character-block-and-flat-style-icon-free-vector.jpg'), ), - Text(_contact.mobileNumber), ], - ), + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://cdn5.vectorstock.com/i/1000x1000/50/29/avatar-icon-of-girl-in-a-wide-brim-felt-hat-vector-16225029.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/002/002/257/non_2x/beautiful-woman-avatar-character-icon-free-vector.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://cdn5.vectorstock.com/i/1000x1000/13/89/cartoon-avatar-woman-front-view-vector-9421389.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://image.freepik.com/free-vector/smiling-girl-avatar_102172-32.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://cdn.vox-cdn.com/thumbor/MPkildnEorylZbEWbx48GuLmvW0=/1400x1400/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/22541126/friends1.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://image.shutterstock.com/image-vector/portrait-beautiful-woman-halfturn-avatar-260nw-1828327529.jpg'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTex6bwWp4_-rgdVmm7NCyL01rb9OWaDUKMPKV03xNvJsqVfGs1Y1TVFPke3VwGVskinbA&usqp=CAU'), + ), + ], + )), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Column( + children: [ + CircleAvatar( + radius: 35, + backgroundImage: NetworkImage( + 'https://i.pinimg.com/originals/77/b8/32/77b832e7293d48acf9004d5cf6d64396.jpg'), + ), + ], + )), + /* + Padding( + padding: const EdgeInsets.only(top: 20), + child: Container( + width: 100, + child: + Center(child: Text('mariAnn', overflow: TextOverflow.ellipsis)), ), - Text(_contact.date.toIso8601String().split('T').first), - Expanded( - child: Container(), + ) + */ + ]), + ), + Divider(), + //posts + Column( + children: [ + Post('worood1_', 'Baghadad', 100), + Post1('Jawaher_28', 'Mosul', 120), + Post3('roselinda707', 'Hilla', 100), + Post4('jana.3s', 'hilla', 200), + Post5('o_meka_p', 'Baghdad', 150), + Post6('alquds.ahmed', 'Duhok', 100), + Post7('ruqaiax', 'Anbar', 110), + Post8('hamas', 'Baghdad', 150), + ], + ) + ]), + ); +} + +Widget Post(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://images.pexels.com/videos/7346487/20-25-years-old-woman-abstract-african-american-girl-afro-7346487.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500', + )), ), - if (_contact.isIncoming) - Icon( - Icons.arrow_downward, - color: Colors.red, - ) - else - Icon( - Icons.arrow_upward, - color: Colors.green, - ) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) ], ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, ), - ); - } + Column( + children: [ + Image( + image: NetworkImage( + 'https://images.unsplash.com/photo-1533003505519-6a9b92ed4911?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80')), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + //Icon(Icons.speaker_notes_outlined), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} - Widget buildContactsList() { - return ListView.builder( - itemBuilder: (_context, index) { - return buildContactItem(contacts[index]); - }, - itemCount: contacts.length, - ); - } +//////////////////////////////////////////////////////// +Widget Post1(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/002/603/683/non_2x/mother-day-mom-character-block-and-flat-style-icon-free-vector.jpg', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage( + 'https://fashionista.com/.image/t_share/MTU0MjIxNDI1NDM4MjM4MDMy/versace-fur-free.jpg'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + //Icon(Icons.speaker_notes_outlined), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), +/////////////////////////////////////////////////////////// +/// +Widget Post3(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTex6bwWp4_-rgdVmm7NCyL01rb9OWaDUKMPKV03xNvJsqVfGs1Y1TVFPke3VwGVskinbA&usqp=CAU', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, ), - body: Center( - child: _pages[_selectedIndex], + Column( + children: [ + Image( + image: NetworkImage( + 'https://thumbs.dreamstime.com/b/aesthetic-background-beach-222938985.jpg'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], ), - bottomNavigationBar: BottomNavigationBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Recent', + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), ), - BottomNavigationBarItem( - icon: Icon(Icons.favorite), - label: 'Favorites', + //Icon(Icons.speaker_notes_outlined), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), ), - BottomNavigationBarItem( - icon: Icon(Icons.access_time_outlined), - label: 'School', - activeIcon: Icon(Icons.access_time_filled) + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), ), ], - currentIndex: _selectedIndex, - selectedItemColor: Colors.amber[800], - onTap: _onItemTapped, ), - ); - } + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '2 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +//////////////////////////////////////////////////// +Widget Post4(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://i.pinimg.com/originals/77/b8/32/77b832e7293d48acf9004d5cf6d64396.jpg', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage( + 'https://purewows3.imgix.net/images/articles/2019_11/friends-thankgiving-episodes-400.jpg?auto=format,compress&cs=strip'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + //Icon(Icons.speaker_notes_outlined), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +//////////////////////////////////////////////////// +/// +Widget Post5(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTTIAzHQ0qFo6a2Wr1kEyCvCFGBrrL5rtULQA&usqp=CAU', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage( + 'https://st3.depositphotos.com/8163870/18594/v/380/depositphotos_185943826-stock-illustration-modern-geometric-greek-seamless-pattern.jpg'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +/////////////////////////////////////////////// +/// +Widget Post6(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://cdn-icons-png.flaticon.com/512/194/194938.png', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage('https://i.imgflip.com/55cw4k.jpg'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +////////////////////////////////////////////////// +/// +Widget Post7(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://image.shutterstock.com/image-vector/portrait-beautiful-woman-halfturn-avatar-260nw-1828327529.jpg', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage( + 'https://i1.sndcdn.com/artworks-000210380355-os67kh-t500x500.jpg'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + //Icon(Icons.speaker_notes_outlined), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +//////////////////////////////////////////////// +/// +Widget Post8(name, location, like) { + return Column( + children: [ + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + // hasStory ? smallProfileWithStory() : smallProfileWithoutStory() + Padding( + padding: const EdgeInsets.only(left: 5, top: 3), + child: CircleAvatar( + radius: 20, + backgroundImage: NetworkImage( + 'https://t4.ftcdn.net/jpg/03/42/83/77/360_F_342837754_fAC5ZI8YK8zSMYxXIZeIXFkx4sJCzDNV.jpg', + )), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + location, + style: TextStyle(fontSize: 16), + ), + ], + ) + ], + ), + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: Icon( + Icons.more_vert, + ), + ) + ]), + SizedBox( + height: 7, + ), + Column( + children: [ + Image( + image: NetworkImage( + 'https://imgix.bustle.com/wmag/2019/09/08/5d7462456cf4020008a91400_Serichai_BrandonMa__well_BTS-033.jpg?w=1200&fit=crop&crop=faces&auto=format%2Ccompress'), + width: double.maxFinite, + fit: BoxFit.cover, + ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Icon( + Icons.favorite_border_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.mode_comment_outlined, + size: 45, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 15.0, top: 3.0), + child: Icon( + Icons.near_me_outlined, + size: 45, + ), + ), + SizedBox( + width: 500, + ), + Padding( + padding: const EdgeInsets.only(top: 3.0, right: 2.0), + child: Icon(Icons.bookmark_outline_sharp, size: 45), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 2.0, top: 3.0), + child: Container( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Text( + '$like likes', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + Text( + '$name', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Text( + 'Add a comment ...', + style: TextStyle(fontSize: 15, color: Colors.black54), + ), + Text( + '3 days ago', + style: TextStyle(fontSize: 10, color: Colors.black54), + ) + ], + ), + ) + ], + ); +} + +Widget personal() { + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.white, + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SizedBox(width: 10), + Text( + 'Worood1_', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.black), + ), + SizedBox(width: 400), + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: Image.network( + 'https://cdn3.iconfinder.com/data/icons/instagram-18/512/199_Instagram_Plus_Sets_Upload-512.png', + height: 35, + ), + ), + Icon( + Icons.dehaze, + size: 45, + ) + ], + ), + ], + )), + body: Column(children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.only(top: 3.0, left: 16.0), + child: CircleAvatar( + radius: 90, + backgroundImage: NetworkImage( + 'https://static.vecteezy.com/system/resources/previews/001/912/726/non_2x/beautiful-woman-in-frame-circular-avatar-character-free-vector.jpg'), + ), + ), + SizedBox( + width: 80, + ), + Text('0', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.black, + )), + SizedBox( + width: 90, + ), + Text('83', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.black, + )), + SizedBox( + width: 90, + ), + Text('200', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Colors.black, + )) + ], + ), + Column(children: [ + Row( + children: [ + SizedBox( + width: 250, + ), + Text('Posts', + style: TextStyle( + fontSize: 25, + color: Colors.black54, + )), + SizedBox( + width: 50, + ), + Text('Followers', + style: TextStyle( + fontSize: 25, + color: Colors.black54, + )), + SizedBox( + width: 50, + ), + Text('Following', + style: TextStyle( + fontSize: 25, + color: Colors.black54, + )) + ], + ), + Column( + children: [ + Row( + children: [ + Column(children: [ + Padding( + padding: const EdgeInsets.only(top: 15, left: 16.0), + child: Text( + 'My name is worood', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 30), + ), + ) + ]) + ], + ), + Row( + children: [ + Column(children: [ + Padding( + padding: const EdgeInsets.only(top: 20, left: 5.0), + child: Row(children: [ + Container( + child: Center( + child: Text( + 'Edit Profile', + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 20), + ), + ), + height: 50, + //width: double.maxFinite, + //fit: BoxFit.cover + width: 550, + decoration: BoxDecoration( + //color: Colors.white, + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.black54, + width: 3, + ), + borderRadius: + BorderRadius.all(Radius.circular(10)))) + ]), + ), + ]), + SizedBox( + width: 10, + ), + Column(children: [ + Padding( + padding: const EdgeInsets.only(top: 8.0, left: 3.0), + child: Row(children: [ + Container( + child: Icon( + Icons.arrow_drop_down, + size: 30, + ), + height: 50, + width: 50, + decoration: BoxDecoration( + //color: Colors.white, + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.black54, + width: 3, + ), + borderRadius: + BorderRadius.all(Radius.circular(10)))) + ]), + ), + ]), + ], + ), + Padding( + padding: const EdgeInsets.all(50.0), + child: Row( + children: [ + IconButton( + onPressed: () => print('Profile'), + icon: Icon( + Icons.grid_on_sharp, + size: 60, + ), + ), + SizedBox(width: 400), + IconButton( + onPressed: () => print('Photos and Videos of You'), + icon: Icon( + Icons.perm_contact_cal_outlined, + color: Colors.black54, + size: 60, + ), + ) + ], + ), + ), + ], + ), + ]) + ])); }